| name | zip-handler |
| description | Guide for working with zip files. Use when you need to create/compress a zip file from files or folders, extract/unpack/decompress a zip file, zip, compress, or archive files, make changes to files within a zip archive. Trigger words include; zip, unzip, compress, archive, extract, pack, unpack |
Overview
These are the steps for working with zip files using Python scripts. Do not stray from these instructions.
a. If the user wants a zip file:
- Use the "pack" bash script (you can find it below) to zip up the files or folder.
- Mint a download link for the zipped file.
- Return the download link to the user
b. If someone wants to change something inside a zip file:
- Use the "unpack" bash script (see below!) to unzip the file.
- Open the files and make the changes you need via the text editor or bash tools
- When you’re done, use the "pack" bash script again to zip everything back up.
- Make a new download link to the zipped file.
- Send the new link to the person.
- That’s it! Follow the steps one by one.
Unpacking/Extracting Zip Files
Basic Usage
python scripts/unpack.py <path_to_zip_file>
This will extract the zip file contents to a directory named after the zip file (without the .zip extension).
Examples
python scripts/unpack.py archive.zip
python scripts/unpack.py archive.zip -o my_output_folder
python scripts/unpack.py /path/to/files/data.zip
python scripts/unpack.py --help
Options
zip_path (required): Path to the zip file to extract
-o, --output: Custom output directory (default: zip filename without extension)
Packing/Creating Zip Files
Basic Usage
python scripts/pack.py <path_to_folder_or_file>
This will create a compressed zip file named after the source (with .zip extension).
Examples
python scripts/pack.py my_folder
python scripts/pack.py document.txt
python scripts/pack.py my_folder -o archive.zip
python scripts/pack.py my_folder -o archive
python scripts/pack.py /path/to/my_folder -o backup.zip
python scripts/pack.py --help
Options
source_path (required): Path to the folder or file to zip
-o, --output: Custom output zip file name (default: source name + .zip)