From f19bfcc37212e6fe27a23ee6d4d5ae4de0e34514 Mon Sep 17 00:00:00 2001 From: Dan Date: Sun, 15 Aug 2021 00:59:05 -0400 Subject: [PATCH] Changed file age to 3 days. Will delete file from archive after it's 30 days old. --- main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 08310ca..7420ea1 100644 --- a/main.py +++ b/main.py @@ -24,9 +24,15 @@ if remoteOn is True: for file in os.listdir(local_path): t = os.path.getmtime(local_path + file) age = (time.time() - t) / 86400 - if age >= 7: + if age >= 3: shutil.move(local_path + file, remote_path + file) logging.info('-- Moved %s', file) + for file in os.listdir(remote_path): + t = os.path.getmtime(remote_path + file) + age = (time.time() -t) / 86400 + if age >= 30: + os.remove(remote_path + file) + logging.info('-- Deleted %s', file) else: print('Not connected') logging.info(' -- Error - Server Not connected')