@@ -0,0 +1,1048 @@
+from os import walk%0Afrom os.path import join%0Afrom argparse import ArgumentParser%0A%0Aif __name__ == %22__main__%22:%0A    parser = ArgumentParser(%22Find duplicate file names within a directory structure%22)%0A    parser.add_argument(%22dirs%22, help=%22Directories to search for duplicate file names%22%0A                        , nargs=%22*%22)%0A    parser.add_argument(%22--silent%22, help=%22Supress printing of filenames, just return number of duplicates%22, action=%22store_true%22)%0A    args = parser.parse_args()%0A%0A    scanned_files = %7B%7D%0A%0A    for dir in args.dirs:%0A        for root, dirs, files in walk(dir):%0A            for file in files:%0A                scanned_files.setdefault(file, %5B%5D)%0A                scanned_files%5Bfile%5D.append(join(root, file))%0A%0A    count_dupe = 0%0A    for key, value in scanned_files.iteritems():%0A        if len(value) %3E 1:%0A            count_dupe += 1%0A            if not args.silent:%0A                print(%22Multiple files found with name %7B%7D%22.format(key))%0A                for file in value:%0A                    print(%22  %7B%7D%22.format(file))%0A%0A    exit(count_dupe)%0A%0A

Add a git hook script that will list all duplicate files within the directories specified