Log rolling question
Larry Bates
larry.bates at websafe.com
Tue Oct 25 13:16:22 EDT 2005
import time
#
# 120 days, 24 hours, 60 monutes, 60 seconds
#
fourmonthsago=time.time()-(120*24*60*60)
Compare fourmonthsago value to modified date of files.
Delete those that are less.
Larry Bates
elake wrote:
> I have an application that creates a lot of large log files. I only
> want to keep logs for the previous 4 months. I am looking for a way to
> list the contents of the log dir and if the create date on the log is
> older than 4 months delete it. I have looked at the os.stat() function
> to get the created date but I can't figure out how to get the date to
> go back to a previos time.
>
> Any help would be appreciated.
>
More information about the Python-list
mailing list