Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers find_duplicates.py Source File

find_duplicates.py

00001 from os import walk
00002 from os.path import join, abspath, dirname, basename, splitext
00003 import sys
00004 
00005 ROOT = abspath(join(dirname(__file__), "..", ".."))
00006 sys.path.insert(0, ROOT)
00007 
00008 from tools.toolchains.gcc import GCC_ARM
00009 from tools.targets import TARGET_MAP
00010 from argparse import ArgumentParser
00011 
00012 if __name__ == "__main__":
00013     parser = ArgumentParser("Find duplicate file names within a directory structure")
00014     parser.add_argument("dirs", help="Directories to search for duplicate file names"
00015                         , nargs="*")
00016     parser.add_argument("--silent", help="Supress printing of filenames, just return number of duplicates", action="store_true")
00017     args = parser.parse_args()
00018 
00019     toolchain = GCC_ARM(TARGET_MAP["K64F"])
00020 
00021     resources = sum([toolchain.scan_resources(d) for d in args.dirs], None)
00022 
00023     scanned_files = {}
00024 
00025     exit(resources.detect_duplicates(toolchain))
00026