同步文件

This commit is contained in:
zhbaor 2021-11-02 16:52:50 +08:00
parent 0962af6579
commit 2520bf558b

View file

@ -1,6 +1,7 @@
from configparser import ConfigParser from configparser import ConfigParser
from pathlib import Path from pathlib import Path
from json import dump from json import dump
import subprocess
config = ConfigParser() config = ConfigParser()
@ -49,3 +50,21 @@ def generate_db(config: ConfigParser) -> None:
generate_db(config) 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))