⎗ ✓ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97import os, hashlib mopath_old = "S:\\Mod Organizer\\" mopath_new = "C:\\Users\\Fedora\\Downloads\\Mod Organizer v1_3_11-1334-1-3-11\\ModOrganizer\\" def extractBase(p, i): s = p.split("\\") r = "" for n,e in enumerate(s): r = r + e if n > i else r r = r + "\\" if n > i and n != len(s)-1 else r return r mopath_old_files = [extractBase(e, 1) for e in os.popen("dir \"%s\" /s /a:-d /b" % mopath_old).read().split("\n")] mopath_new_files = [extractBase(e, 5) for e in os.popen("dir \"%s\" /s /a:-d /b" % mopath_new).read().split("\n")] mopath_present_files = [x for x in mopath_old_files if x in mopath_new_files] mopath_missing_files = [x for x in mopath_old_files if x not in mopath_new_files] io_failure = False for present_file in mopath_present_files: if present_file == "": continue present_file_old = mopath_old + present_file present_file_new = mopath_new + present_file io_old = open(present_file_old, "rb") io_new = open(present_file_new, "rb") hash_old = hashlib.new("sha1") hash_new = hashlib.new("sha1") buffer_old = io_old.read(1) buffer_new = io_old.read(1) if buffer_old and buffer_new: hash_old.update(buffer_old) hash_new.update(buffer_new) if io_failure: io_failure = False print("==== END IO FAILURE ====\n\n\n\n\n") else: if not io_failure: io_failure = True print("\n\n\n\n\n==== FILE IO FAILURE ====") print(present_file_old) print(present_file_new) print("") io_old.close() io_new.close() continue buffer_old = io_old.read(1024) while buffer_old: hash_old.update(buffer_old) buffer_old = io_old.read(1024) buffer_new = io_new.read(1024) while buffer_new: hash_new.update(buffer_new) buffer_new = io_new.read(1024) digest_old, digest_new = hash_old.hexdigest(), hash_new.hexdigest() discrepancy_message = "" if digest_old != digest_new: print() print("{0} IS NOT {1}".format(digest_old, digest_new)) print("OLD:",present_file_old) print("NEW:",present_file_new) print() io_old.close() io_new.close()