How to get a directory list sorted by date?

Tim Chase python.list at tim.thechases.com
Sun May 15 07:19:17 EDT 2016


On 2016-05-15 20:48, Steven D'Aprano wrote:
> Also, remember that most operating systems provide (at least) three
> different times. I'm not sure which one you want, but if I had to
> guess, I would probably guess mtime. If I remember correctly:
> 
> atime is usually the last access time;
> mtime is usually the last modification time;
> ctime is the creation time, but only on OS-X;
> ctime on Linux and Windows is, um, something else...
> 
> To use one of the other two, change "st_mtime" to "st_ctime" or
> "st_atime".

As an added wrinkle, some of us turn off "atime" in our /etc/ftab
because it tends to slow things down with little benefit in return.
So Steven was right to recommend "mtime" as it's usually what people
want.

-tkc






More information about the Python-list mailing list