Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 21 lines (16 sloc) 416 Bytes
#!/usr/bin/env python
import os
import sys
import hashlib
if len(sys.argv) != 2:
print 'Usage: find-duplicates <directory>'
sys.exit(1)
seen = {}
for subdir, dirs, files in os.walk(sys.argv[1]):
for file in files:
file = os.path.join(subdir, file)
md5 = hashlib.md5(open(file).read()).hexdigest()
if md5 in seen:
print "%s <==> %s" % (file, seen[md5])
else:
seen[md5] = file
Jump to Line
Something went wrong with that request. Please try again.