Re: Get age of a file/dir



Carl J. Van Arsdall wrote:
I've been looking around the OS module and I haven't found anything
useful yet. Does anyone know how to get the age of a file or directory
in days? I'm using unix and don't seem to find anything that will help
me. The only function that comes close so far is

os.path.getctime(path)


However this only gets creation time on Windows, on Unix it gets the the
time of the last change. Any ideas?

Thanks!

-carl

--

Carl J. Van Arsdall
cvanarsdall@xxxxxxxxxx
Build and Release
MontaVista Software

Hi,
You should check out the datetime module. And convert dates to an
ordinal number.
today = datetime.date.today().toordinal()
age = today - datetime.date(year, month, day).toordinal()
Jim

.



Relevant Pages

  • Get age of a file/dir
    ... Does anyone know how to get the age of a file or directory in days? ... However this only gets creation time on Windows, on Unix it gets the the time of the last change. ... Carl J. Van Arsdall ...
    (comp.lang.python)
  • Re: Neilsson
    ... the following persons of the right age are ... Given name: Carl August ... Parish: Skeppstad ... Date of emigration: 1869-04-23 ...
    (soc.genealogy.nordic)
  • Re: Neilsson
    ... the following persons of the right age are ... Given name: Carl August ... Date of emigration: 1869-04-23 ... Source code: 1:182:486 ...
    (soc.genealogy.nordic)
  • Re: The best time to start a new student - opinions?
    ... > Hi Carl ... >> A close friend of mine started at age 4, and 50 years later he makes ... By age 4 1/2 he was ... I think he's safer blowing on a mouthpiece. ...
    (rec.music.makers.trumpet)
  • Re: Inheriting group ownership under Red Hat Linux?
    ... On June 23, 2004 05:20 pm, Carl Riches wrote: ... > use a shared directory under Linux and under Unix. ... > as the owner and a secondary group to which I belong as the group owner. ...
    (RedHat)