470,606 Members | 2,436 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,606 developers. It's quick & easy.

Re: Get oldest folder

jy******@kc.rr.com wrote:
I'd like to be able to get the path to the oldest folder in whatever directory
I'm currently in. Is there a simple way to go about this?
I'd like it to run on both OS X and Windows XP.
I found this example but was curious if there's a better way to do this?
Better: I don't know. Alternative, certainly:

import os, glob

PATH = "c:/python25/lib/site-packages"
print min ((f for f in glob.glob (os.path.join (PATH, "*")) if os.path.isdir (f)), key=os.path.getctime)

Jun 27 '08 #1
0 677

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.