Python 尋找文件夾里以特定格式結尾的文件


代碼:

import os, re, time


name = 'linuxday01'
flags = True
# 文件夾bi_test中的文件列表
print os.listdir('E:\\bi_test') while flags: for f in os.listdir('E:\\bi_test'):
     # 尋找以name開頭,以.download結尾的文件
if re.search(name + '\.(.*)\.download$', f): print f print '沒有完成' time.sleep(5) #flags =False print '完成'
# 當前時間
print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())
 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM