xdufacool/dupcheck.py
def remove_dup_files():
    """Remove duplicated files based on the results of fdupes."""

    parser = argparse.ArgumentParser(description='Remove dup files')
    parser.add_argument('--base-dir', '-d', type=str,
                        help='The base directory for reference, files should be kept')
    parser.add_argument('--backup-dir', '-b', type=str,
                        help='The backup directory where duplicated files should be removed.')
    parser.add_argument('--dup-log', '-l', type=str,
                        help='A YAML file of duplicated files for logging.')
    parser.add_argument('filelist', type=str,
                        help='List of files created by find for duplication check.')

    args = parser.parse_args()

    files = load_list(args.filelist)
    filelist = FileList(files)
    for prop in ['size', 'sha256-partial', 'sha256']:
        filelist.collect_property(prop)
        base_dir = args.base_dir if prop == 'size' else None
        filelist.find_duplication(prop, base_dir)
    dup_simplified = simplify_dupdict(filelist.duplications)
    if args.dup_log:
        dupdict_to_yaml(args.dup_log, dup_simplified)
    if args.base_dir:
        remove_dupfile(dup_simplified, args.base_dir)
Remove duplicated files based on the results of fdupes.
Remove duplicated files based on the results of fdupes.
Remove duplicated files based on the results of fdupes .
def remove_dup_files():
    parser = argparse.ArgumentParser(description='Remove dup files')
    parser.add_argument('--base-dir', '-d', type=str,
                        help='The base directory for reference, files should be kept')
    parser.add_argument('--backup-dir', '-b', type=str,
                        help='The backup directory where duplicated files should be removed.')
    parser.add_argument('--dup-log', '-l', type=str,
                        help='A YAML file of duplicated files for logging.')
    parser.add_argument('filelist', type=str,
                        help='List of files created by find for duplication check.')
    args = parser.parse_args()
    files = load_list(args.filelist)
    filelist = FileList(files)
    for prop in ['size', 'sha256-partial', 'sha256']:
        filelist.collect_property(prop)
        base_dir = args.base_dir if prop == 'size' else None
        filelist.find_duplication(prop, base_dir)
    dup_simplified = simplify_dupdict(filelist.duplications)
    if args.dup_log:
        dupdict_to_yaml(args.dup_log, dup_simplified)
    if args.base_dir:
        remove_dupfile(dup_simplified, args.base_dir)
def remove_dup_files ( ) : parser = argparse . ArgumentParser ( description = 'Remove dup files' ) parser . add_argument ( '--base-dir' , '-d' , type = str , help = 'The base directory for reference, files should be kept' ) parser . add_argument ( '--backup-dir' , '-b' , type = str , help = 'The backup directory where duplicated files should be removed.' ) parser . add_argument ( '--dup-log' , '-l' , type = str , help = 'A YAML file of duplicated files for logging.' ) parser . add_argument ( 'filelist' , type = str , help = 'List of files created by find for duplication check.' ) args = parser . parse_args ( ) files = load_list ( args . filelist ) filelist = FileList ( files ) for prop in [ 'size' , 'sha256-partial' , 'sha256' ] : filelist . collect_property ( prop ) base_dir = args . base_dir if prop == 'size' else None filelist . find_duplication ( prop , base_dir ) dup_simplified = simplify_dupdict ( filelist . duplications ) if args . dup_log : dupdict_to_yaml ( args . dup_log , dup_simplified ) if args . base_dir : remove_dupfile ( dup_simplified , args . base_dir )
Remove duplicated files based on the results of fdupes.
Remove duplicated files based on the results of fdupes .
"""Remove duplicated files based on the results of fdupes."""