path = u"H:\\data)"
outpath = u"H:\\output0"
current_files = os.listdir(path)
for file_name in current_files:

print(file_name)
dirname = path + "\\" + file_name + "\\DLG"
if not os.path.exists(dirname):
continue
os.mkdir(outpath + "\\" + file_name)
filelist = []
for root, dirlist, files in os.walk(dirname):
for filename in files:
filelist.append(os.path.join(root, filename))

#Start to zip file ...
fullzipfilename = outpath + "\\"+ file_name + "\\DLG.zip"
destZip = zipfile.ZipFile(fullzipfilename, "w")
for eachfile in filelist:
destfile = eachfile[len(dirname):]
print("Zip file %s..." % destfile)
destZip.write(eachfile, destfile)
destZip.close()

#os.mkdir(outpath + "\\" + file_name)

相关文章:

  • 2021-06-25
  • 2022-12-23
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2021-08-15
  • 2021-12-02
  • 2021-11-04
相关资源
相似解决方案