473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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:

<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 767

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: | last post by:
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...
0
by: Tim Golden | last post by:
jyoung79@kc.rr.com wrote: And just because I'm feeling silly: <code> import os print os.popen ("dir /b /ad /od /tc c:\python25\lib\site-packages").readline () </code>
0
by: | last post by:
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...
2
by: RuiT | last post by:
Hello I want to detect when a new file is added to a existing folder and access it. How can I do this (C#)? Thanks
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.