Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (16 sloc) 649 Bytes
#!/usr/bin/env python3
# run this script with a cron job to delete expired files
# it takes the path of your upload folder as in argument
# e.g. ./ /home/user/0x1/uploads
# modified from
import os, sys, time, datetime, json
files = [f for f in os.listdir(".")]
jsonData = json.load(open('config.json'))
maxage = jsonData['filePersistence']
for f in files:
stat = os.stat(f)
systime = time.time()
age = datetime.timedelta(seconds = systime - stat.st_mtime).days
if age >= maxage: