470,810 Members | 1,367 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

RE:Get oldest folder

Hi Tim,

Thanks very much for your help! I'm still just learning Python and really appreciate seeing other peoples examples on how they work with Python. Thanks again for taking the time to share this.

Jay
>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:
><code>
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)
></code>
>TJG
Jun 27 '08 #1
0 584

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by frankabel | last post: by
5 posts views Thread by Eric Chong | last post: by
2 posts views Thread by Shimon Sim | last post: by
14 posts views Thread by Mike | last post: by
4 posts views Thread by =?Utf-8?B?TWFyaw==?= | last post: by
5 posts views Thread by PhilTheGap | last post: by
5 posts views Thread by =?Utf-8?B?SmVycnkgQw==?= | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.