Dec-25-2022, 02:32 PM
Hello,
This snippet allows to find duplicate files in multiple directories and count the number of duplicates.
Any ideas ?
Thanks.
This snippet allows to find duplicate files in multiple directories and count the number of duplicates.
import os dir1 = '/...path1/' dir2 = '/...path1/' dir3 = '/...path3/' dir4 = '/...path4/' dir5 = '/...path5/' list1 = [dir1, dir2, dir3, dir4, dir5] files = [] for folder in list1: files = files + [f for f in os.listdir(folder)] dup = {x for x in files if files.count(x) > 1} for item in sorted(dup): print('{}\t{}'.format(item, files.count(item)))What I'm looking for is to create a dataset (maybe a dictionary) where each duplicate file is associated with the locations where the duplicates of the file occur.
Any ideas ?
Thanks.