#!/usr/bin/python import sys, os, time, shutil weekdays = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] os.chdir('/cygdrive/c/windows/temp') if not os.path.exists('camarchive'): os.mkdir('camarchive') while True: mtime = os.stat('webcam.jpg')[8] archivename = time.strftime('%H-%M-%S', time.localtime(mtime)) weekday = weekdays[time.localtime(mtime)[6]] seconds = time.localtime(mtime)[5] if not seconds % 10: # only archive every 10 seconds archivefile = 'camarchive/%s-%s.jpg' % (weekday, archivename) if not os.path.exists(archivefile): shutil.copyfile('webcam.jpg', archivefile) time.sleep(0.5)