示例#1
0
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)
示例#2
0
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
    )
示例#3
0
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)
示例#4
0
        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 }
示例#5
0
        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}
示例#6
0
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)