Created
August 29, 2018 01:18
-
-
Save benwei/f3fe687de8f3b5e177480a49a1f1060e to your computer and use it in GitHub Desktop.
Generate single check sum of a directory's contents
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 | |
target="$1" | |
if [ -z "$target" ]; then | |
echo "syntax: <folder-name>" | |
exit 1 | |
fi | |
find $target -type f -exec md5sum {} + | cut -d" " -f1 | sort | md5sum | cut -d" " -f1 | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment