Currently I am taking advantage of the free month of training from Pluralsight. I was going through a Python course and this was one of the chapters.
I didn’t realise how simple it was to create a zip archive in Python.
All you need is a simple couple of lines.
Python 2.7.16 (default, Jan 26 2020, 23:50:38)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import zipfile
zipf = zipfile.ZipFile('./craigtest.zip','w',allowZip64=True)
zipf.write('./test1ppt.py')
zipf.write('./test.pptx')
zipf.close()
Simple as that so you could easily list all the files in a directory, and write them out to a Zip file in a script.
Within a few simple lines you could easily write a simple backup script of all your key scripts or documents and save the file to Dropbox or OneDrive so you have a backup.
Perhaps a simple nightly backup of all the text logs in a directory as well, you could create the file as a dated zip file, another good use case.
Hope this helps, happy to put these examples up for you just say if you would like to see this.
