I'm trying to create a basic script that will remove old backup files (more than 30 days) from a directory based upon timestamp. The system it will run on is Windows XP. I created this and ran it on one box and it seemed to work fine, when I ported it to the actual box it needs to run on it is not removing the files. I ran the script with "python -i" so it dumped me into interactive mode and I confirmed that the current object was ok, I confirmed it is in the correct directory, I confirmed I could so a manual os.remove("file") and it would actually delete the file. This makes me think it is not a permissions issue. But when I run the script it is a no go. I'm basically at a loss as to what to try for troubleshooting next. Backstory, this directory is an iis ftp directory if that makes a difference.
import os, time, sys current = time.time() os.chdir("c:\BACKUPS\DEV1") for f in os.listdir('.'): modtime = os.path.getmtime('.') if modtime < current - 30 * 86400: os.remove(f) This is my first list post. Thanks for any help!
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor