From e5e0841467a2e2a387e5acfd4729503195dcbeb5 Mon Sep 17 00:00:00 2001 From: rlbr Date: Tue, 27 Nov 2018 13:03:29 -0600 Subject: [PATCH] Fixed bug where duplicate hashes were not counted --- backup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backup.py b/backup.py index 77baf43..e54d6f4 100755 --- a/backup.py +++ b/backup.py @@ -25,7 +25,7 @@ def file_hash(path, block_size=4096*8): else: bytes = f.read() _hash.update(bytes) - return path,_hash.digest() + return _hash.digest() def hashify(top): old_dir = os.getcwd() @@ -39,7 +39,10 @@ def hashify(top): imohash = _imohash(filepath) real_hash = None if imohash in imo_hashes: + print(filepath) real_hash = file_hash(filepath) + else: + imo_hashes.add(imohash) ret.append( ( filepath, @@ -52,6 +55,7 @@ def hashify(top): except Exception as e: print(e,file) os.chdir(old_dir) + #print(imo_hashes) return ret def __init_database__(path):