Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to remove duplicate files from folder with python

def remove_duplicates(dir):
    unique = []
    for filename in os.listdir(dir):
        if os.path.isfile(filename):
            filehash = md5.md5(file(filename).read()).hexdigest()
            if filehash not in unique: 
                unique.append(filehash)
            else: 
                os.remove(filename)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #duplicate #files #folder #python
ADD COMMENT
Topic
Name
8+8 =