I got my resource completely through here:


First you need md5deep and sort (which comes with every linux, just not the md5deep program):

apt-get update; apt-get install md5deep;

Which says to check differences like this:

diff <(sort <(md5deep -r $DIR1) |cut -f1 -d' ') <(sort <(md5deep -r $DIR2) |cut -f1 -d' ')

As explained in link the output only tells you if the  the directories differ. Where they differ is hard to tell because the output is just mds.

Here is my script version of the above, called ddiffq, if the output returns nothing, then we know the directories are the same. If the output returns anything then we know there are differences.

# usage: ddiffq /dir1 /dir2
# no output means the directories are the same recursively
ONED=`sort <(md5deep -r $ONE)`
TWOD=`sort <(md5deep -r $TWO)`
diff <(echo "$ONED" |cut -f1 -d' ') <(echo "$TWOD" |cut -f1 -d' ')

Here is my attempt at seeing where they differ, using the script ddiff. The output if they are different is just the md5s, well we can use the md5s to search for the files. That works well, unless multiple versions of that file exist all of the place. So its okay, the best and most reliable output, is to just see if they are truely different, then use other tools to see where they differ (or use the md5s and manually reverse engineer all of the files and figure out where thats different)

# usage: ddiff /dir1 /dir2
# if no output then the folders are the same,
# the output tries to locate the different files (but that becomes hard when many files with same md5 exist)
ONED=`sort <(md5deep -r $ONE)`
TWOD=`sort <(md5deep -r $TWO)`
BOTHD=$(echo "$ONED"; echo "$TWOD";)
diff <(echo "$ONED" |cut -f1 -d' ') <(echo "$TWOD" |cut -f1 -d' ') | grep "^[<>]" > /tmp/ddiffanswer
for i in `cat /tmp/ddiffanswer`; do
MD=`echo $i | cut -f2 -d' '`
FILE=`echo "$BOTHD" | grep $MD | head -n1 | awk '{print $NF}'`
echo $i $FILE




Leave a Reply

Your email address will not be published. Required fields are marked *