Re: Compare 2 times



On Jun 6, 7:50 am, loial <jldunn2...@xxxxxxxxx> wrote:
I have a requirement to test the creation time of a file with the
current time and raise a message if the file is  more than 15 minutes
old.

Platform is Unix.

I have looked at using os.path.getctime for the file creation time and
time.time() for the current time, but is this the best approach?

Unless you are using ext4 you are going to have to store the creation
time yourself. If the files are coming from your application, use the
sqlite3 or shelve module to store the creation time for each file then
check that data to determine which files are more than 15 minutes old.

If the files are being generated from another application or from
users, have your application check the directory every minute and
record any new files. Worst case scenario, a file will be present for
16 minutes vs 15.
.



Relevant Pages

  • Re: Creation date from Solaris file
    ... > Unix doesn't store the creation time. ... $ GetFileInfo src ... interpose libaries to store the creation date in a hidden attribute. ...
    (comp.sys.sun.admin)
  • Re: Compare 2 times
    ... current time and raise a message if the file is more than 15 minutes ... Platform is Unix. ... The creation time is not ...
    (comp.lang.python)
  • Re: Compare 2 times
    ... current time and raise a message if the file is more than 15 minutes ... Platform is Unix. ... The creation time is not ...
    (comp.lang.python)
  • Re: how to delete files that create date <=20041210
    ... And has has been pointed out in various UNIX groups, ... Unix does not store the file's creation time. ... DeeDee, don't press that button! ...
    (comp.lang.perl.misc)
  • Re: Compare 2 times
    ... Platform is Unix. ... Unless you are using ext4 you are going to have to store the creation ... sqlite3 or shelve module to store the creation time for each file then ... file .signature infected by signature virus. ...
    (comp.lang.python)