How can I generate one text-file containing all sha1 hashes of all files on a dvd with many folders and subfolders?
1 Answer
Use find
find /path/to/DVD -exec sha1sum {} + > text.file
-
could you please explain the parameters being passed to sha1sum? i mean how does
'{}' \;
work– astrob0tNov 9, 2014 at 1:30 -
2Thank you Oli. astrob0t - -exec passes the file to a command, sha1sum, and the {} represent the file, + or \; continues to next file. the find command has a number of options and can seem complex, See content.hccfl.edu/pollock/Unix/FindCmd.htm for a great intro– PantherNov 9, 2014 at 1:51
-
1@astrob0t That's just how
find
substitutes the files it finds into commands. I've actually switched out{} \;
for{} +
. Instead of runningsha1sum file1; sha1sum file2 ...
it runssha1sum file1 file2 ...
. Only works when the command can take multiple files like that but makes things faster.– Oli ♦Nov 9, 2014 at 1:52