You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
358 B
Python
24 lines
358 B
Python
#/bin/env python
|
|
|
|
from hashlib import md5
|
|
import os
|
|
|
|
# remove duplicates
|
|
|
|
filedict = dict()
|
|
|
|
for root, dirs, files in os.walk('.'):
|
|
for f in files:
|
|
path = os.path.join(root, f)
|
|
fo = open(path)
|
|
content = fo.read()
|
|
fo.close()
|
|
h = md5(content).hexdigest()
|
|
if filedict.get(h, None):
|
|
os.remove(path)
|
|
else:
|
|
filedict[h] = path
|
|
|
|
print filedict
|
|
|