//View Tip #850
» Disable bash history
» Generate a random password
» Vi mode in bash
» Diff Two Directories
Similar Tips
» Randomize lines in a file» Disable bash history
» Generate a random password
» Vi mode in bash
» Diff Two Directories
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Do a sha256sum of an entire directory name directory and check for integrity.
Modifying the IFS variable is necessary for filename with space.
Modifying the IFS variable is necessary for filename with space.
$ IFS=' ' $ for i in $(find directory -type f -print);do sha256sum "$i";done > directory.SHA256SUM $ sha256sum -c directory.SHA256SUM
Comments
Add your comment
Comments are currently disabled
This handles spaces, does not need IFS set.
find directory -type f -print0 | xargs -0 sha256sum > directory.SHA256SUM
find directory -type f -print0 | xargs -0 sha256sum > directory.SHA256SUM
Posted 2009-07-01 00:47:22
to generate recursively:
find . -type f -exec sha512sum {} \; > sha512sum-${PWD##*/}
to check:
sha512sum -c sha512sum-${PWD##*/} | grep -i fail
ps.: "${PWD##*/}" is only the directory name, like: "pwd | rev | cut -d / -f1 | rev"
http://szabadlinuxot.blogspot. … 6/sha.html
find . -type f -exec sha512sum {} \; > sha512sum-${PWD##*/}
to check:
sha512sum -c sha512sum-${PWD##*/} | grep -i fail
ps.: "${PWD##*/}" is only the directory name, like: "pwd | rev | cut -d / -f1 | rev"
http://szabadlinuxot.blogspot. … 6/sha.html
Posted 2009-07-01 09:52:45


# find directory -type f -exec sha256sum {} \; > directory.SHA256SUM
# sha256sum -c directory.SHA256SUM
Just to save some typing ;-)
BTW.: For bigger dirs using xargs might save more time.