本地的测试环境产生了许多的缓存文件,写了个脚本来删除,这样在sv的时候不用眼花缭乱了
- #!/usr/bin
-
import os,re
-
-
def main():
-
listdir(tpl_path)
-
-
def listdir(path):
-
dirs = os.listdir(path)
-
for dirname in dirs:
-
file_path = os.path.join(path, dirname)
-
if os.path.isdir(file_path):
-
listdir(file_path)
-
else:
-
if re.match('^%.*html\.php$', dirname):
-
deleteCache(file_path)
-
-
def deleteCache(filepath):
-
print filepath
-
os.remove(filepath)
-
-
if '__main__' == __name__:
-
tpl_path = "D:\\var\\www\\template"
-
main()
阅读(2151) | 评论(0) | 转发(0) |