How to recursively create md5 and sha1 sum of your files.

Submitted by rex on Wed, 09/23/2009 - 16:48

Sometimes you want to check if your files has been modified.
With this command you can create for all files in your working directory (and sub directories) md5 and sha1 sum and display them.

save this commands bottom as 'sum.sh' and run 'chmod a+x sum.sh' to make is executeable.


#!/bin/bash

md5=$(md5sum "$1"|awk '{print $1}')
sha1=$(sha1sum "$1"|awk '{print $1}')
path=$(echo $1|cut -c 3-)
echo "$path $md5 $sha1"

exit 0

run this command


find ./ -type f -exec ./sum.sh '{}' \;

output looks like:


download/goldwave512.exe 8674b26830ee98a7e237c2741a907b70 bef8935b85a2d78e6267980f4d9faeeb9b458de5
download/edonkey2000s1636.zip 7c9d216ebc785b89f3602f48f87f05ce 5dc4cd569e2d94b7c3026f0baa6061387f4569bb
download/winamp155.exe 3a70bb3961ea7a0b66f4744038d4658e 5fc50dd53486345b444877cf5945614a86e8850f
download/winrar330.exe 4f036bf544e03d30e54b25f807b4ec38 484d6f40c9a018582a2f7187c2d257309132c42d
download/picasa2808.exe b99c4a5674e47e1c8ed21816141238bb 52af5bfb28c67f218f88f0f59df5ed50643395c7
download/utorrent173.exe be19d3de7e1a41a160931d29b49b2e78 0870f7ecbbee8d7be1c90e86f906c1d25faf0268

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.