Rob Lingelbach wrote: > >Has anybody ever written a script that would rebuild the html message >archives that would also modify the file ctime/mtime back to the date >of the message, as retrieved from the list's mbox file?
This script ----------------------------------------------------------------------- import os import re import time import os.path BASE = '/usr/local/mailman/archives/private/listname' NRE = re.compile(r'^\d+.html$') DRE = re.compile(r'^\s*<I>([^<]*)</I>\s*$') def process_file(pname): for line in open(pname): mo = DRE.match(line) if mo: try: ptime = time.strptime(mo.group(1), '%a %b %d %H:%M:%S %Z %Y') except ValueError: next ptime = time.mktime(ptime) os.utime(pname, (ptime, ptime)) break for dir, dirnames, filenames in os.walk(BASE): for fname in filenames: if NRE.match(fname): process_file(os.path.join(dir, fname)) ----------------------------------------------------------------------- will change atime and mtime for all the nnnnnn.html files subordinate to the BASE directory to the time parsed from the line <I>Day Mmm dd hh:mm:ss TZ yyyy</I> in the file. It only changes atime and mtime to that time. ctime is changed to the time that it runs. -- Mark Sapiro <m...@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan ------------------------------------------------------ Mailman-Users mailing list Mailman-Users@python.org http://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://wiki.list.org/x/AgA3 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: http://mail.python.org/mailman/options/mailman-users/archive%40jab.org Security Policy: http://wiki.list.org/x/QIA9