예제 #1
0
파일: dupfind.py 프로젝트: apostiglioni/dup
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)