Created
October 29, 2014 14:22
-
-
Save madcoda/127898c3d0ed0e913bca to your computer and use it in GitHub Desktop.
Compute a SHA-1 hash of a directory (sort of)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# arguments check | |
if [ -z "$1" ] | |
then | |
echo "Usage: sha1dir /path/to/directory" | |
exit 1 | |
fi | |
# run sha1sum on every file | |
cd $1 | |
find . -type f -print0 | xargs -0 sha1sum | sort | sha1sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment