From 08b483140c29e1740fd626e58764df4287eebb48 Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Wed, 20 Mar 2024 17:39:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3FTP=E5=AE=A1=E8=AE=A1?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=97=A0=E6=B3=95=E6=B8=85=E7=90=86=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/audits/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/audits/tasks.py b/apps/audits/tasks.py index f16a792a6..97f46adc5 100644 --- a/apps/audits/tasks.py +++ b/apps/audits/tasks.py @@ -58,9 +58,9 @@ def clean_ftp_log_period(): now = timezone.now() days = get_log_keep_day('FTP_LOG_KEEP_DAYS') expired_day = now - datetime.timedelta(days=days) - file_store_dir = os.path.join(default_storage.base_location, 'ftp_file') + file_store_dir = os.path.join(default_storage.base_location, FTPLog.upload_to) FTPLog.objects.filter(date_start__lt=expired_day).delete() - command = "find %s -mtime +%s -exec rm -f {} \\;" % ( + command = "find %s -mtime +%s -type f -exec rm -f {} \\;" % ( file_store_dir, days ) subprocess.call(command, shell=True)