Skip to content

Instantly share code, notes, and snippets.

@madcoda
Created October 29, 2014 14:22
Show Gist options
  • Save madcoda/127898c3d0ed0e913bca to your computer and use it in GitHub Desktop.
Save madcoda/127898c3d0ed0e913bca to your computer and use it in GitHub Desktop.
Compute a SHA-1 hash of a directory (sort of)
#!/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