Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import defaultdict
- from pathlib import Path
- from pprint import pprint
- from hashlib import md5
- def find_files(directory):
- for path in directory.rglob('*'):
- if path.is_file():
- yield path
- hashes = defaultdict(list)
- for path in find_files(Path.cwd()):
- key = md5(path.read_bytes()).hexdigest()
- hashes[key].append(path)
- pprint(hashes)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement