Eric Azarcon wrote:

[...]


My needs are pretty simple. Maybe you can point me in the right
direction. I need to compare the creation time of a file with a date,
and determine if I need to delete it. I know how to use stat to get the
file creation time. I can get the current time. If I subtract the file
ctime from the current time, how do i turn that delta into days?


[EMAIL PROTECTED] ~ $ python Python 2.4 (#1, Dec 4 2004, 20:10:33) [GCC 3.3.3 (cygwin special)] on cygwin Type "help", "copyright", "credits" or "license" for more information. >>> from stat import ST_CTIME >>> from os import stat >>> s = stat("xmlpractical.txt") >>> s (33279, 1407374883881497L, 1410850211L, 1, 544, 513, 5859L, 1103556876, 1102382453, 1102292631) >>> ctime = s[ST_CTIME] >>> ctime 1102292631 >>> import time >>> print "File was created", (time.time() - ctime)/(3600*24), "days ago" File was created 14.6398609114 days ago

Does this do it?

regards
 Steve
--
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to