Re: Get age of a file/dir
- From: "Jim" <jscrerar@xxxxxxxxxxxxxx>
- Date: 1 Aug 2006 16:07:02 -0700
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
.
- Follow-Ups:
- Re: Get age of a file/dir
- From: url81-1
- Re: Get age of a file/dir
- References:
- Get age of a file/dir
- From: Carl J. Van Arsdall
- Get age of a file/dir
- Prev by Date: Re: Windows vs. Linux
- Next by Date: Re: Reinstalling Python Problem (Newbie)
- Previous by thread: Get age of a file/dir
- Next by thread: Re: Get age of a file/dir
- Index(es):
Relevant Pages
|