Programmer's Limbo
Journey through The Road-of-Code, Posting tid-bits & (challenges) I discover daily.
Thursday, October 6, 2011
Friday, September 23, 2011
Saturday, September 3, 2011
Friday, July 15, 2011
A Small Python Module: Get latest directory
- import os
- import time
- import operator
- def latestDir(path):
- alist={}
- now = time.time()
- directory=os.path.join(path,"")
- os.chdir(directory)
- for file in os.listdir("."):
- if os.path.isdir(file):
- timestamp = os.path.getmtime( file )
- # get timestamp and directory name and store to dictionary
- alist[os.path.join(os.getcwd(),file)]=timestamp
- # sort the timestamp
- for i in sorted(alist.iteritems(), key=operator.itemgetter(1)):
- latest="%s" % ( i[0])
- print "newest directory is ", latest
- return latest
Example USE:
scanPath = 'D:/dushyantka'
latestDir (scanPath)
!
Wednesday, June 8, 2011
Nuke | Python
Diving into python these days, customizing Foundry Nuke a lil, 'll get back here... soon.
...
...
Wednesday, May 11, 2011
Subscribe to:
Posts (Atom)