RHash
RHash copied to clipboard
rfe: --strip-path
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:
rather then
This feature is hard to design (especially to work the same on Linux and Windows).
-
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.
-
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