//Random Tip
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

You are viewing a random entry, refresh your browser to change.

Do a sha256sum of an entire directory name directory and check for integrity.
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


View Comments »



Comments 

Add your comment

Comments are currently disabled
Mattes
How about this:

# 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.
Posted 2009-06-29 20:09:10
Tim
Or:
sha256sum $(find .ssh -type f)
Posted 2009-06-29 20:20:17
Kevin Grover
This handles spaces, does not need IFS set.

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
Posted 2009-07-01 09:52:45

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit