How to create a zip archive of a directory in Python

Creating a zip archive of a directory compresses each file in the directory for efficient storage and transfer.

Solution for How to create a zip archive of a directory in Python : You can use shutil.make_archive() to create a zip archive of a directory Call shutil.make_archive(base_name, format, root_dir) with format as “zip” to create a zip archive from root_dir called base_name.

The result is the directory stored as a zip file in the current directory of the Python script.


how-to-create-a-zip-archive-of-a-directory-in-python