Skip to content

Instantly share code, notes, and snippets.

@benwei
Created August 29, 2018 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benwei/f3fe687de8f3b5e177480a49a1f1060e to your computer and use it in GitHub Desktop.
Save benwei/f3fe687de8f3b5e177480a49a1f1060e to your computer and use it in GitHub Desktop.
Generate single check sum of a directory's contents
#!/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