get the latest file in a directory
Gustavo Niemeyer
niemeyer at conectiva.com
Wed Oct 29 16:46:25 EST 2003
More information about the Python-list mailing list
Wed Oct 29 16:46:25 EST 2003
- Previous message (by thread): get the latest file in a directory
- Next message (by thread): get the latest file in a directory
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> I was wondering what is a quick way to find the latest(last modified
> date) file from a directory.
>>> l = [(os.path.getmtime(x), x) for x in os.listdir(".")]
>>> l.sort()
>>> l[-1]
(1067457449, '.svn')
--
Gustavo Niemeyer
http://niemeyer.net
- Previous message (by thread): get the latest file in a directory
- Next message (by thread): get the latest file in a directory
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list