Browse Source

Fixed bug where duplicate hashes were not counted

restore_refactor
Raphael Roberts 7 years ago
parent
commit
e5e0841467
  1. 6
      backup.py

6
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):

Loading…
Cancel
Save