作者在 2010-06-09 13:24:40 发布以下内容
保存下来,以后说不定用的到
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import time
import datetime
time1 = '2010-4-1 12:33' #指定时间
root1 = 'D:\\WWW' #指定文件夹
def txt_2_time(txt):
l = txt.replace(' ','-').replace(':','-').split('-')
l = map(int,l)
s = datetime.datetime(*l)
t = time.mktime(s.timetuple())
return t
for root,dirs,files in os.walk(root1):
for file in files:
f = os.path.join(root,file)
mtime = os.path.getmtime(f)
if os.path.splitext(f)[1] in ('.html','.php') and mtime > txt_2_time(time1):
print f,time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(mtime))
# -*- coding: UTF-8 -*-
import os
import time
import datetime
time1 = '2010-4-1 12:33' #指定时间
root1 = 'D:\\WWW' #指定文件夹
def txt_2_time(txt):
l = txt.replace(' ','-').replace(':','-').split('-')
l = map(int,l)
s = datetime.datetime(*l)
t = time.mktime(s.timetuple())
return t
for root,dirs,files in os.walk(root1):
for file in files:
f = os.path.join(root,file)
mtime = os.path.getmtime(f)
if os.path.splitext(f)[1] in ('.html','.php') and mtime > txt_2_time(time1):
print f,time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(mtime))