import pathlib import argparse from media import Media def find_all_files(directory: pathlib.Path): ps = [] for p in directory.rglob('*'): if "eaDir" not in str(p): ps.append((p)) return ps if __name__ == "__main__": parser = argparse.ArgumentParser(description='convert hardlink to symlink in download folder') parser.add_argument('Library', metavar='--library', type=str, help='the path to library') args = parser.parse_args() path_library = args.Library paths = find_all_files(pathlib.Path(path_library)) for x in paths: tempx = Media(x) if tempx.is_symlink: tempx.convert_symlink_to_hdlink()