Skip to content

Commit

Permalink
script that detects duplicate files
Browse files Browse the repository at this point in the history
  • Loading branch information
j605 committed Dec 18, 2011
1 parent f96656b commit d36d547
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions list_duplicate_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! /usr/bin/python2.7

import os
import os.path
from sys import argv

extension = 'mp3'
mp3 = []

def confirm(arg, directory, files):
for File in files:
if len(File.split('.')) == 2:
if File.split('.')[1] == extension:
mp3.append(os.path.join(directory, File))

os.path.walk('/media/E', confirm, None)
cmd = 'md5sum'
md5sums = []
for song in mp3:
c = list(song)
c.insert(0,'"')
c.append('"')
c = ''.join(c)
try:
fp = os.popen(cmd + ' ' + c)
md5sums.append(fp.read())
except:
print "error"

print len(md5sums), ' ', len(mp3)
1 change: 1 addition & 0 deletions out

Large diffs are not rendered by default.

0 comments on commit d36d547

Please sign in to comment.