python版本为:2.7 import os import sys import time # Sets how many days old files are deleted DAYS_N = 7 # To delete the path and the following subfiles PATH = r'C:\inetpub\logs\LogFiles' def deletefile(PATH): for eachfile in os.listdir(PATH): filename =
python脚本 删除2天前后缀为.log的文件 #!/usr/local/python/bin/python #-*-coding=utf8 -*- import time import os,sys N = 2 #设置删除多少天前的文件 def deletefile(path): for eachfile in os.listdir(path): filename = os.path.join(path,eachfile) if os.path.isfile(filename): lastm