how to filter files by creation date

awel albert.wellens at
Tue Nov 6 08:33:16 CET 2007

Hello All,

I am trying to to make a script to move all the files that has been
created at today's to another folder but my problem is the date format
that I receive from the 'os.stat  [stat.ST_CTIME]' is different from
the one that I receive from the ''.

Does someone could help me?
Here is my script:

import os, stat, time, datetime
a= "c:\\"
filesys = os.listdir(a)
def get_create_time(a):
     int_time = os.stat("c:\\")[stat.ST_CTIME]
     str_time = time.ctime(int_time)
     return str_time

#print filesys
for file in filesys:
             create_time = get_create_time(a)
             print file, create_time[-4:]
#             print today


More information about the Python-list mailing list