Hi, I have a small script here that goes to inside dir and sorts the file by create date. I can return the create date but I don't know how to find the name of that file... I need file that is not latest but was created before the last file. Any hints... I am newbiw python dude and still trying to figure out lot of 'stuff'..
import os, time, sys from stat import * def walktree(path): test1 = [] for f in os.listdir(path): filename = os.path.join(path, f) create_date_sces = os.stat(filename)[ST_CTIME] create_date = time.strftime("%Y%m%d%H%M%S", time.localtime(create_date_sces)) print create_date, " ....." , f test1.append(create_date) test1.sort() print test1 return test1[-2] if __name__ == '__main__': path = '\\\\srv12\\c$\\backup\\my_folder\\' prev_file = walktree(path) print "Previous back file is ", prev_file Thank you, hj -- http://mail.python.org/mailman/listinfo/python-list