RHash icon indicating copy to clipboard operation
RHash copied to clipboard

rfe: --strip-path

Open therube opened this issue 2 years ago • 1 comments

rfe: --strip-path such that relative paths are used, even when full(er) path is specified on command line

rhash --strip-path -H c:/tmp/rhash/* would return something like:

doc.txt new.txt testdir/file3.txt

rather then

c:/tmp/rhash/doc.txt c:/tmp/rhash/new.txt c:/tmp/testdir/file3.txt

therube avatar Feb 06 '23 18:02 therube

This feature is hard to design (especially to work the same on Linux and Windows).

  1. The usefulness of the resulting hash file is questionable in the case, when two different directories are passed by command line (and both are stripped from the resulting paths):

    > rhash --strip-path -H c:/dir1/* c:/dir2/*
    dir1_file1.txt
    dir2_file1.txt
    dir2_file2.txt
    

    Before verifying such file, the user shall copy all files from the hashed directories into one directory.

  2. In Linux/Unix wildcards are expanded by the shell and are passed to RHash already as separate files (not directories), so RHash can't detect from paths with wildcards which directory should be stripped from file paths.

    I think the only way for RHash to work the same on all platforms is to strip only directories passed with recursive option (without wildcards support):

    > rhash --recursive --strip-path -H c:/dir1/ c:/dir2/
    dir1_subdirA/file1.txt
    dir2_subdirA/file1.txt
    dir2_subdirB/file2.txt
    

rhash avatar Jul 30 '23 21:07 rhash