Compare commits

..

No commits in common. "76d8c4f01ad350cc9e5ce25aa6bb1ff4cca99a02" and "da49b29471e266486feaaebf52d2873406ed9190" have entirely different histories.

View File

@ -5,16 +5,12 @@ directories = os.listdir('.') ## Get the files in the current directory
files = [] files = []
def quickhash(filefullpath): def quickhash(filefullpath):
try: with open(filefullpath, "rb" ) as f:
with open(filefullpath, "rb" ) as f: md5 = hashlib.md5()
md5 = hashlib.md5() block_size=1024*100
block_size=1024*100 data = f.read(block_size)
data = f.read(block_size) md5.update(data)
md5.update(data) return md5.digest()
return md5.digest()
except OSError as er:
print(f"Error hashing {filefullpath}")
return None
def direcCrawler(): def direcCrawler():
global directories, files global directories, files
@ -35,7 +31,6 @@ def calchashes():
filehashes = {} filehashes = {}
for file in files: for file in files:
hash = quickhash(file) hash = quickhash(file)
if hash = None: continue
## Inefficient to use a catch on every non-duplicate (most of the files) ## Inefficient to use a catch on every non-duplicate (most of the files)
try: filehashes[hash].append(file) try: filehashes[hash].append(file)
except: filehashes[hash] = [file] except: filehashes[hash] = [file]