delete after 10 in index

master
Michael Murtaugh 7 years ago
parent c9a29ee4c8
commit b67562cbd7

@ -5,8 +5,9 @@ import cgitb; cgitb.enable()
from jinja2 import Template
# Directory => ITEMS list (all files with a timestamp name, grouped)
path = "/var/www/static/gait"
try:
ff = os.listdir("/var/www/static/gait")
ff = os.listdir(path)
except OSError:
ff = []
tpat = re.compile(r"^(\d\d\d\d)-(\d\d)-(\d\d)-(\d\d)-(\d\d)-(\d\d)")
@ -25,7 +26,8 @@ items = [items[key] for key in sorted(items, reverse=True)]
for i in items[10:]:
for f in i.items():
print "deleting ", f
# 10 os.unlink(f)
fp = os.path.join(path, f)
os.unlink(fp)
# dump the data (debugging)
# print "Content-type: text/plain"
# print ""

Loading…
Cancel
Save