I made this little script (below) to look througt a dir to see if there are any files newer than .e.g. 1 hour. I have the loop through the dir working and can retreive file time as well as present time. both time variables are in the format returned by time.localtime()
My question: How do I find the difference between such two time variables, to calculate the 'age' of the file? :-) Martin ------8<------ Code begin ------------- import os, time def buildList(directory): listing = os.listdir(directory) for x in listing: x = os.path.join(directory, x) if os.path.isdir(x): print ('dir -> %s') % x if os.path.isfile(x): tstF = time.localtime(os.path.getmtime(x)) nSize = os.path.getsize(x) print ('fil -> %s %d @ %s') % (x, nSize, time.asctime (tstF)) return 0 tstN = time.localtime() print tstN print "Time now: %s" % time.asctime(tstN) buildList('C:\Martin\Work\Work_Eclipse\.metadata') -- http://mail.python.org/mailman/listinfo/python-list