Uncategorized

creating Zip file using shutil module in python


this code will create a plots.zip file but the problem is it is creating 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



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *