Updated to 72 hour retention
This commit is contained in:
parent
f0a70605da
commit
9cb12880cc
@ -179,12 +179,12 @@ def main():
|
|||||||
directory_output_file.write(f"{filename}\n")
|
directory_output_file.write(f"{filename}\n")
|
||||||
|
|
||||||
# Process older files in /opt/cdxfiles/telegram
|
# Process older files in /opt/cdxfiles/telegram
|
||||||
older_than_48_hours = datetime.now() - timedelta(days=2)
|
older_than_72_hours = datetime.now() - timedelta(days=3)
|
||||||
for filename in os.listdir(TELEGRAM_DIRECTORY):
|
for filename in os.listdir(TELEGRAM_DIRECTORY):
|
||||||
file_path = os.path.join(TELEGRAM_DIRECTORY, filename)
|
file_path = os.path.join(TELEGRAM_DIRECTORY, filename)
|
||||||
if filename.endswith(".cdx.json") and os.path.getmtime(file_path) < older_than_48_hours.timestamp():
|
if filename.endswith(".cdx.json") and os.path.getmtime(file_path) < older_than_48_hours.timestamp():
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
print(f"Deleted '{filename}' as it is older than 48 hours.")
|
print(f"Deleted '{filename}' as it is older than 72 hours.")
|
||||||
|
|
||||||
run_ia_command() # Run IA command after processing older files
|
run_ia_command() # Run IA command after processing older files
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user