保存下来,以后说不定用的到
#!/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))
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。