get the latest file in a directory

Joe Francia usenet at soraia.com
Wed Oct 29 17:07:08 EST 2003


Hank wrote:
> Hi, 
> 
> I was wondering what is a quick way to find the latest(last modified
> date) file from a directory.
> 
> Should I use win32file.GetFileTime and compare PyTime? I don't want to
> create a PyHANDLE for every single file in the directory, not if
> there's an easier way at least.

Look at os.stat() and the stat module, along with os.listdir().





More information about the Python-list mailing list