When I run shasum from a several directories up on a single file, I get what I expect and ultimately want:
shasum 2010/Whitmore/The\ Astrophysical\ Journal\ 2010\ Whitmore.pdf
5da84767c2301f29ed3b7db7542167150fe63b8b 2010/Whitmore/The Astrophysical Journal 2010 Whitmore.pdf
When I run find from the same directory, it lists the files no problem:
find 2010/Whitmore/* | xargs -0
2010/Whitmore/The Astrophysical Journal 2010 Whitmore.pdf
I’ve been trying to write a bash script (or just a single line) that will return the individual shasum on each file found by find (there are lots) along with its filename. Piping the filenames to shasum does not work in any of the combinations I’ve tried.
I expect that the problem is with the spaces in the filename, but after Google searching, trying a number of find/xargs/ls combinations (and various combinations of what seemed to work for other people including -print0 flags), I still cannot figure out a way to run shasum on each file under these directories.
An example of the output I want (assuming there are 2 files under Whitmore) in case there’s a completely different way of getting this result:
find 2010/Whitmore/* | xargs -0 | shasum
5da84767c2301f29ed3b7db7542167150fe63b8b 2010/Whitmore/The Astrophysical Journal 2010 Whitmore.pdf
4d2b0a6da00473133b4617d67d9249da3d05cc19 2010/Whitmore/arXiv 2010 Whitmore.pdf
I am on a Mac OSX 10.6
How about using the
-execoption offind?find 2010/Whitmore/* -exec shasum {} \;