Advertisement
Guest User

dedup.py

a guest
Jun 20th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. import os, hashlib
  2.  
  3. md = dict()
  4. for root, dirs, files in os.walk("/storage/emulated/0/DCIM/Camera"):
  5.     for file in files:
  6.         if file.endswith(".jpg"):
  7.              fpath = os.path.join(root, file)
  8.              cksum = hashlib.md5(open(fpath, 'rb').read()).hexdigest()
  9.              if cksum in md:
  10.                 print('Dup: {} of {}'.format(fpath, md[cksum]))
  11.              else:
  12.                 md[cksum] = fpath
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement