delete after 10 in index

master
Michael Murtaugh 8 years ago
parent c9a29ee4c8
commit b67562cbd7

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

Loading…
Cancel
Save