webstudio/web_p/education.py
2024-04-25 12:22:21 +03:00

28 lines
773 B
Python

import shutil
import argparse
import os.path
from pathlib import Path
parser = argparse.ArgumentParser()
parser.add_argument("--path")
parser.add_argument("--name")
args = parser.parse_args()
def copy_and_move_folder(src, dst, folder):
try:
if os.path.exists(dst + "/education/") is False:
Path(dst + "/education/").mkdir(parents=True, exist_ok=True)
if os.path.exists(dst + "/education/" + folder + "/"):
shutil.rmtree(dst + "/education/" + folder + "/")
shutil.copytree(src, dst + "/education/" + folder + "/")
except shutil.Error as e:
print(f"Error: {e}")
source_folder = os.path.dirname(os.path.abspath(__file__)) + "/education"
copy_and_move_folder(source_folder, args.path, args.name)