A rather quick and dirty script I wrote to delete duplicate songs in my iTunes folder. If you run it from your home directory, it creates a shell script which will delete the duplicates.
Make sure you inspect the shell script before you run it!
filenames = dict()
for root, dirs, files in os.walk("Music/"):
for fn in files:
filenames[fn] = os.path.join(root, fn)
print len(filenames), "files."
names = set(filenames.keys())
dupes = set()
for fn in filenames.keys():
if fn[-5] in "123456789" and fn[-6] == " ":
on = fn[:-6] + fn[-4:]
if on in names: dupes.add(filenames[fn])
print len(dupes), "duplicates."
open("delete_dupes.sh","w").write("\n".join('rm "%s"'%f for f in dupes))