Creating Zip file using shutil module in python

55 Views Asked by At

This code will create a plots.zip file, but the problem is that it creates another plots.zip inside that zip file.

shutil.make_archive(outPath + "plots", 'zip', outPath[:-1])

I have tried this method but it is not working:

shutil.make_archive(outPath + "plots", 'zip', outPath[:-1])

It generates like this

folder
│   script.py
└───subfolder1
│   │   file011.txt
│   │   file012.txt
│   │
└───subfolder2
│   │   file011.txt
│   │   file012.txt
│   │
└───zipfile_name.zip
│   │   same content as above (as expected)
│   │   zipfile_name.zip
0

There are 0 best solutions below