diff --git a/manage.py b/manage.py index a1ca599..d257baf 100644 --- a/manage.py +++ b/manage.py @@ -1,6 +1,7 @@ from configparser import ConfigParser from pathlib import Path from json import dump +import subprocess config = ConfigParser() @@ -49,3 +50,21 @@ def generate_db(config: ConfigParser) -> None: generate_db(config) + +sync_all_command = [ + config["ftp"]["lftp"], + f'-e mirror -R -e --parallel=10 {config["file"]["local"]} {config["file"]["remote"]}; exit', + "-u", + f'{config["ftp"]["user"]},{config["ftp"]["pass"]}', + config["ftp"]["host"], +] + +sync_files_command = [ + config["ftp"]["lftp"], + f'-e mirror -R -e --parallel=10 {config["file"]["local"]}/categories {config["file"]["remote"]}/categories; exit', + "-u", + f'{config["ftp"]["user"]},{config["ftp"]["pass"]}', + config["ftp"]["host"], +] + +print(subprocess.run(sync_files_command))