import os
import shutil
from os.path import join

delete = input( "Do you wish to delete duplicates? " )
num = 0

for root, dirs, files in os.walk( '.' ):
	s = set()
	"""
	for f in files:
		if f.upper() in s:
			print "Dup file: " + join( root, f )
			if delete:
				os.remove( join( root, f ) )
		s.add( f.upper() )

		num += 1
		if num % 5000 == 0:
			print "Checked %d files" % (num)
	"""

	s = set()
	for d in dirs:
		if d.upper() in s:
			print "Dup dir:  " + join( root, d )
			if delete:
				shutil.rmtree( join( root, d ) )
		s.add( d.upper() )


