def main(): args_parser = argparse.ArgumentParser() parser = argparse.ArgumentParser() parser.add_argument("path", nargs='+', help="Path where to look for duplicates") parser.add_argument("-u", "--uniques", action="store_true", help="Find unique files") parser.add_argument( "--non-strict", action="store_false", default=True, help="Strict mode. Fails if there are nonreadable entries in the path" ) # parser.add_argument( # "-v", # "--verbosity", # help="Verbosity level (default: WARN)", # default='WARN', # choices=['DEBUG','INFO','WARN','ERROR','CRITICAL'], # type=lambda level: level.upper() # ) # # logging.basicConfig( # level=args.verbosity, # format=args.log_format, # filename=args.log # ) args = parser.parse_args() which = uniques if args.uniques else duplicates action = print_uniques if args.uniques else print_duplicates walk_strict = args.non_strict where = args.path find_files(which, where, action, walk_strict)
def cleanup_files(where, selected, dry_run=True, strict_walk=True): find_files( duplicates, where, action = cleanup(selected, clean_action=dry_run_clean if dry_run else None), strict_walk = strict_walk )
def main(): args_parser = argparse.ArgumentParser() parser = argparse.ArgumentParser() parser.add_argument("path", nargs='+', help="Path where to look for duplicates") parser.add_argument("-u", "--uniques", action="store_true", help="Find unique files") parser.add_argument( "--non-strict", action="store_false", default=True, help="Strict mode. Fails if there are nonreadable entries in the path") # parser.add_argument( # "-v", # "--verbosity", # help="Verbosity level (default: WARN)", # default='WARN', # choices=['DEBUG','INFO','WARN','ERROR','CRITICAL'], # type=lambda level: level.upper() # ) # # logging.basicConfig( # level=args.verbosity, # format=args.log_format, # filename=args.log # ) args = parser.parse_args() which = uniques if args.uniques else duplicates action = print_uniques if args.uniques else print_duplicates walk_strict = args.non_strict where = args.path find_files(which, where, action, walk_strict)
def find(which, where, strict_walk=strict_walk): result = [] find_files(which, where, result.append, strict_walk=strict_walk) return { tuple(cluster) for cluster in result }
def find(which, where, strict_walk=strict_walk): result = [] find_files(which, where, result.append, strict_walk=strict_walk) return {tuple(cluster) for cluster in result}
def cleanup_files(where, selected, dry_run=True, strict_walk=True): find_files(duplicates, where, action=cleanup(selected, clean_action=dry_run_clean if dry_run else None), strict_walk=strict_walk)