how to filter files by creation date
awel
albert.wellens at gmail.com
Tue Nov 6 02:33:16 EST 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 'datetime.date.today()'.
Does someone could help me?
Here is my script:
import os, stat, time, datetime
a= "c:\\"
filesys = os.listdir(a)
today= datetime.date.today()
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
Thanks
Awel
More information about the Python-list
mailing list