#!/usr/bin/env python
#coding=utf-8
import os
import shutil
filelist=[]
rootdir="E://11111"
filelist=os.listdir(rootdir)
print filelist
for f in filelist:
filepath = os.path.join( rootdir, f )
if os.path.isfile(filepath):
os.remove(filepath)
print filepath+" removed!"
elif os.path.isdir(filepath):
shutil.rmtree(filepath,True)
print "dir "+filepath+" removed!"
python 删除文件及文件夹下的文件夹脚本(自己加个定时修改个路径ok)
最新推荐文章于 2023-01-11 15:53:30 发布