Changed file age to 3 days. Will delete file from archive after it's 30 days old.

This commit is contained in:
Dan
2021-08-15 00:59:05 -04:00
parent 7528127773
commit f19bfcc372

View File

@@ -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')