shutil make_archive resulting in nested .zip files [duplicate]

社会主义新天地 提交于 2019-12-06 00:24:11

I also encountered this problem. Here's a simple trick to solve the issue: use a relative path as the base_name:

from shutil import make_archive
make_archive(
  '../zipfile_name', 
  'zip',           # archive format
  root_dir=None,   # current working dir if None
  base_dir=None)   # cwd if None 

The archive will be created in the parent directory, not interfering with the directory that is being archived.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!