On Wed, Jun 25, 2008 at 2:21 PM, chase pettet <[EMAIL PROTECTED]> wrote:
> 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)
>
I'm not in a place where I can test anything at the moment, but the first
thing I always do in situations like this is to throw print/logging
statements all over the place so I can see what's going on. (Slows it down
terribly, but it's temporary, right?)
I would do something like this:
for f in os.listdir('.'):
modtime = os.path.getmtime('.')
print f, modtime
if modtime < current - 30 * 86400:
print f, " should be removed... is it?"
os.remove(f)
At least it'll give you some idea of where things are going wrong. As I
say, it's always the first thing I try. It's rarely the last.
> This is my first list post. Thanks for any help!
>
Welcome to the list! Pull up a chair...
--
www.fsrtechnologies.com
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor