Snippets     

Change File Dates
Description: Add one year to file dates.
Language: Python
Category: File

import glob, os, time

f = glob.glob('*')

for filename in f:
	s = os.stat(filename)
	t = time.gmtime(s.st_mtime)
	newtime = time.mktime((t.tm_year+1, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, t.tm_wday, t.tm_yday, t.tm_isdst))
	print time.asctime(time.gmtime(newtime))
	os.utime(filename, (newtime, newtime))
Back


  Copyright 2009 Isaac Roach iroach@gmail.com