bash geeking

I am archiving my photos onto DVD’s so I thought I would be smart and create MD5 sums of the files so I could verify the DVD is still good. Except I screwed up a little. The files I created contained the following

MD5 (./034/DSC_4109.JPG) = 294b6282bfcaca127f680d88240d4192

So I had to do a little bash scripting to split the file and then compare the files, this is what I came up with

for a in `ls *.JPG`; do export MD5=`md5 -q $a`; export MD52=`cat $a.md5`; MD53=${MD5#*=}; if [ $MD5 == $MD53 ]; then echo "$MD5 $a good"; fi; done

Tags: , ,

Comments are closed.