Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rfe: --strip-path #231

Open
therube opened this issue Feb 6, 2023 · 1 comment
Open

rfe: --strip-path #231

therube opened this issue Feb 6, 2023 · 1 comment
Labels

Comments

@therube
Copy link

therube commented Feb 6, 2023

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

@rhash
Copy link
Owner

rhash commented Jul 30, 2023

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 rhash added the FR label Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants