Hi all
I'm new to python.
Can some one help me in writing a script, that deletes all the files whose age is more that a week in a directory?
Is this possible?
plz help me
tnx
bobbie
* Some way of testing the age of the files. I would
suggest os.stat (eg: os.stat('filename').st_mtime.
You'll also want to compare this with current time
and see if the difference is over 7 days...
time.time() returns current time, and
datetime.timedelta provides a handy way to compare
time intervals.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.