# 删除文件以及文件夹
def removeDir(dirPath):
if not os.path.isdir(dirPath):
return
files = os.listdir(dirPath)
try:
for file in files:
filePath = os.path.join(dirPath, file)
if os.path.isfile(filePath):
os.remove(filePath)
elif os.path.isdir(filePath):
removeDir(filePath)
os.rmdir(dirPath)
except Exception, e:
print e
# 删除配置文件
def deletework(outputpath):
try:
flag = os.path.exists(outputpath)
except Exception, e:
print "delete work Error !"
if flag == True:
removeDir(outputpath)
print "deletework End !"
def removeDir(dirPath):
if not os.path.isdir(dirPath):
return
files = os.listdir(dirPath)
try:
for file in files:
filePath = os.path.join(dirPath, file)
if os.path.isfile(filePath):
os.remove(filePath)
elif os.path.isdir(filePath):
removeDir(filePath)
os.rmdir(dirPath)
except Exception, e:
print e
# 删除配置文件
def deletework(outputpath):
try:
flag = os.path.exists(outputpath)
except Exception, e:
print "delete work Error !"
if flag == True:
removeDir(outputpath)
print "deletework End !"