# 解压主目录以及子目录下zip文件到各自目录,并删除zip
import os
dir_name = "/home/data/"
def unzipAllFiles(dir_name):
listOfFile = os.listdir(dir_name)
allFiles = list()
for entry in listOfFile:
fullPath = os.path.join(dir_name, entry)
if os.path.isdir(fullPath):
allFiles = allFiles + unzipAllFiles(fullPath)
else:
if os.path.splitext(fullPath)[1] == '.zip':
allFiles.append(fullPath)
os.system('unzip -n ' +fullPath+ ' -d '+ dir_name + '; rm -rf ' + fullPath)
ubuntu python unzip主目录以及子目录
最新推荐文章于 2024-02-29 17:14:17 发布