cornsnake.zip_dir

Function for creating a zip archive from a directory. The create_zip function creates a zip archive of a specified directory.

Documentation

 1"""
 2Function for creating a zip archive from a directory. The `create_zip` function creates a zip archive of a specified directory.
 3
 4[Documentation](http://docs.mrseanryan.cornsnake.s3-website-eu-west-1.amazonaws.com/cornsnake/zip_dir.html)
 5"""
 6
 7import shutil
 8
 9
10def create_zip(source_dir, output_zip_file):
11    """
12    Function to create a zip archive from a directory.
13
14    Args:
15    source_dir (str): The path to the source directory to be zipped.
16    output_zip_file (str): The name of the output zip file.
17
18    Returns:
19    None
20    """
21    if output_zip_file.endswith(".zip"):
22        output_zip_file = output_zip_file[:-4]
23    shutil.make_archive(output_zip_file, "zip", source_dir)
def create_zip(source_dir, output_zip_file):
11def create_zip(source_dir, output_zip_file):
12    """
13    Function to create a zip archive from a directory.
14
15    Args:
16    source_dir (str): The path to the source directory to be zipped.
17    output_zip_file (str): The name of the output zip file.
18
19    Returns:
20    None
21    """
22    if output_zip_file.endswith(".zip"):
23        output_zip_file = output_zip_file[:-4]
24    shutil.make_archive(output_zip_file, "zip", source_dir)

Function to create a zip archive from a directory.

Args: source_dir (str): The path to the source directory to be zipped. output_zip_file (str): The name of the output zip file.

Returns: None