Chronological Processing of Files

Peter Hansen peter at engcorp.com
Wed Sep 21 18:16:00 EDT 2005


yoda wrote:
> This feels like a stupid question but I'll ask it anyway.
> 
> How can I process files chronologically (newest last) when using
> os.walk()?

Do you want the ordering to apply just to files within each directory, 
or to all the files found (recursively) during the entire walk?  Define 
"newest" (most recent modified date or something else?).  Is there any 
reason why sorting with the results of os.access().st_mtime as the key 
is not possible or sufficient?

-Peter



More information about the Python-list mailing list