From 2520bf558bc80c277fee7f6458d5630514eb1741 Mon Sep 17 00:00:00 2001 From: Zhao Zuohong <1040110848@qq.com> Date: Tue, 2 Nov 2021 16:52:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manage.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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))