Skip to content

Instantly share code, notes, and snippets.

@bblanchon
Last active September 18, 2015 15:19
Show Gist options
  • Save bblanchon/d1869a7418d3067984d1 to your computer and use it in GitHub Desktop.
Save bblanchon/d1869a7418d3067984d1 to your computer and use it in GitHub Desktop.
Compute checksums of files in each folder recursivlty
find $(pwd) -type d | while read DIR
do
cd $DIR
FILES=$(find -maxdepth 1 -type f -not -name '*SUMS' -printf '"%f"\n' | sort)
FILE_COUNT=$(echo $FILES | wc -c)
if [ -z "$FILES" ]
then
rm -f *SUMS
else
echo $FILES | xargs md5sum > MD5SUMS
echo $FILES | xargs sha1sum > SHA1SUMS
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment