From f5ec3bba3d447bf77a744ad6c81bb2b695279a33 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 30 Oct 2022 22:34:18 +0800 Subject: [PATCH] =?UTF-8?q?ftp=E5=A4=87=E4=BB=BD=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/backup_ftp/class/ftp_client.py | 4 ++-- plugins/backup_ftp/index.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/backup_ftp/class/ftp_client.py b/plugins/backup_ftp/class/ftp_client.py index c16e0981e..5d6c54007 100644 --- a/plugins/backup_ftp/class/ftp_client.py +++ b/plugins/backup_ftp/class/ftp_client.py @@ -187,7 +187,7 @@ class FtpPSClient: } mw.writeFile(pg_file, json.dumps(progress_info)) else: - progress_info = json.loads(public.readFile(pg_file)) + progress_info = json.loads(mw.readFile(pg_file)) if total_bytes == progress_info.get("total_bytes"): # 取远程文件大小 _max_loop = 10 @@ -352,7 +352,7 @@ class FtpPSClient: ftp.rmd(dir_name) return True except ftplib.error_perm as e: - print(str(e) + ":" + dir_name) + print("deleteDir:" + str(e) + ":" + dir_name) except Exception as e: print(e) return False diff --git a/plugins/backup_ftp/index.py b/plugins/backup_ftp/index.py index 5c8f2e299..bb7784a1b 100755 --- a/plugins/backup_ftp/index.py +++ b/plugins/backup_ftp/index.py @@ -192,10 +192,12 @@ def backupAllFunc(stype): prefix_dict[stype] + '_' + name find_new_file = "ls " + find_path + \ - "_* | grep tar.gz | cut -d \ -f 1 | awk 'END {print}'" + "_* | grep '.gz' | cut -d \ -f 1 | awk 'END {print}'" filename = mw.execShell(find_new_file)[0].strip() - # print("filename:", filename) + if filename == "": + print("not find upload file!") + return False ftp = FtpPSClient() ftp.uploadFile(filename, stype)