Spaces:
Sleeping
Sleeping
File size: 537 Bytes
c7f3ffb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import os
import subprocess
from pathlib import Path
def link_file(from_file, to_file):
subprocess.check_call(
f'ln -s "`realpath --relative-to="{os.path.dirname(to_file)}" "{from_file}"`" "{to_file}"', shell=True)
def move_file(from_file, to_file):
subprocess.check_call(f'mv "{from_file}" "{to_file}"', shell=True)
def copy_file(from_file, to_file):
subprocess.check_call(f'cp -r "{from_file}" "{to_file}"', shell=True)
def safe_path(path):
os.makedirs(Path(path).parent, exist_ok=True)
return path
|