I want use MD5 to compare both folder in Python.

Following steps that i want to compare both folder by using MD5:

1. After all the files downloaded to folderA.
2. All the files inside folderA will copy to folderB.
3. Then MD5 will compare both folder is correct hash.
4. Then return True.

Generally module md5 is used to encrypt strings/texts like passwords by making a unique check sum of the string. Once encrypted you cannot decrypt the resulting check sum back to the original string. The only way you can find out its contents is to encrypt another string and compare the md5 check sums.

Here is an example ...

# Note that Python30 dropped md5 and uses hashlib.md5()

import md5
mystring = "meet me at Karl's bar on Friday the tenth at 9PM"
print( md5.md5(mystring).hexdigest() )

You can save the text to a file and attach the hexdigest string as a final line.

Edited 7 Years Ago by vegaseat: ref to check sums

You're probably going to want to use some recursion when you're searching through the directories. If you copy subfolders you're going to want to know if the files in the subfolders have also copied properly.

You can see some examples of using recursion to list all the files in a directory and its subdirectories in this thread: http://www.daniweb.com/forums/thread234497.html

This question has already been answered. Start a new discussion instead.