0

I'm using hashdeep to calculate checksums, recursively for files. However, I need to exclude certain directories and so the solution would seem to be to use find to feed a file list to hashdeep. This is mostly working well.

hashdeep -c md5 -f <(find . -type f -and -not -path '\./excludeme*')

For testing, this can be simplified to:

hashdeep -c md5 -f <(find . -type f)

The trouble is that I've started seeing files that have been named in an unfortunate way. e.g. they have a carriage return in the file name. I didn't put it there but it's not my place to go and fix it.

We can manufacture a file like that with:

touch file$'\r'

hashdeep on its own can cope with this:

$ hashdeep -c md5 -r .

%%%% HASHDEEP-1.0
%%%% size,md5,filename
## Invoked from: /home/myusername/hashdeeptest
## $ hashdeep -c md5 -r .
##
0,d41d8cd98f00b204e9800998ecf8427e,/home/myusername/hashdeeptest/file

If I use the invocation with find from above though, I get:

./file: No such file or directory

I suspect there is some way to get find to feed the file name to hashdeep in a way that it finds palatable, but at the moment that eludes me.

Many thanks for a solution!

0

Browse other questions tagged or ask your own question.