def dupes(dirinfo: DirInfo) -> None: """Show groups of duplicate files in directory.""" for group in dirinfo.dupe_groups(): example = next(iter(group)) hashcode = binascii.hexlify(example.hash).decode('ascii') print( f'{len(group)} duplicates with size {example.size}, hash {hashcode}' ) for name in sorted(str(file.relpath) for file in group): print(f' {name}')
def info(dirinfo: DirInfo) -> None: """Read and summarize directory info.""" files = plural(dirinfo.file_count, 'file') groups = plural(sum(1 for _ in dirinfo.dupe_groups()), 'dupe group') tqdm.write(f'Found {files} and {groups}')