synology_link_manipultor/symlink_to_hdlink.py

28 lines
760 B
Python
Raw Permalink Normal View History

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:
2021-07-17 23:50:30 +10:00
tempx = Media(x)
if tempx.is_symlink:
tempx.convert_symlink_to_hdlink()