Zip Creator with Ignore Support
This Python script creates a zip archive of a folder while respecting an ignore
file (similar to .gitignore). It also supports adding a prefix to all files
inside the archive, similar to git archive --prefix.
Features
- Exclude files and folders using a
.zipignorefile (or a custom ignore file) - Add an optional prefix inside the zip
- Command-line interface for easy use
Installation
Ensure you have Python >= 3.10 installed and install it with pipx:
pipx install zipcreater-sebastian-stigler
Usage
zipcreator [-h] [-o OUTPUT_ZIP] [--ignore-file IGNORE_FILE] [--prefix PREFIX] source_folder
positional arguments:
source_folder Folder to zip
options:
-h, --help show this help message and exit
-o OUTPUT_ZIP, --output_zip OUTPUT_ZIP
Output zip file name (default: archive.zip)
--ignore-file IGNORE_FILE
Ignore file (default: .zipignore)
--prefix PREFIX Prefix inside the zip (e.g., 'myproject/')
--version show program's version number and exit
Examples
1. Basic Usage
zipcreator my_folder -o output.zip
This zips my_folder into output.zip, using .zipignore within my_folder to exclude files.
2. Add a Prefix
zipcreator my_folder -o output.zip --prefix myproject/
This adds myproject/ as a prefix inside the zip.
3. Use a Custom Ignore File
zipcreator my_folder -o output.zip --ignore-file custom.ignore
This uses custom.ignore instead of .zipignore. (The file has to be stored in my_folder.)
Example .zipignore File
# Ignore log files
*.log
# Ignore temporary files
*.tmp
*.bak
# Ignore folders
node_modules/
venv/
# Ignore specific files
secrets.env
debug-output.txt
# Ignore system files
.DS_Store
Thumbs.db
# Ignore __pycache__ directories
__pycache__/
# Ignore build outputs
build/
dist/
# Allow a specific file inside an ignored folder
!dist/readme.txt
Example Output with --prefix myproject/
If your original my_folder structure is:
my_folder/
│── file1.txt
│── file2.log
│── subdir/
│ └── nested.txt
And .zipignore contains:
*.log
Then output.zip will contain:
myproject/file1.txt
myproject/subdir/nested.txt
(file2.log is ignored due to .zipignore)
Licence
MIT Licence
Credit
Created with ChatGPT.
Metadata
Release files for zipcreator-sebastian-stigler 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zipcreator_sebastian_stigler-0.1.1.tar.gz | 3.8 kB | Without provenance | Details for zipcreator_sebastian_stigler-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zipcreator_sebastian_stigler-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for zipcreator_sebastian_stigler-0.1.1-py3-none-any.whl |
Total release size: 8.4 kB
Release files / zipcreator_sebastian_stigler-0.1.1.tar.gz
| Download URL | zipcreator_sebastian_stigler-0.1.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee010db826d1b0a47e1a6b6dc6f3cefa94fc24084a83744159773a852f45b994
|
|
BLAKE2b-256 checksum How to use checksums |
9e59ebd374e9f67539871fa29b438200d2937dcefdf79f0025ab1556b7227e1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.9
|
Release files / zipcreator_sebastian_stigler-0.1.1-py3-none-any.whl
| Download URL | zipcreator_sebastian_stigler-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62344b19fc1a830c7a243bfe3359013c613dc3ba13ed5d115006cfff309f9c7d
|
|
BLAKE2b-256 checksum How to use checksums |
ae185ded3bb3db74b22cd93c994136fb855563db8ea85fdd43ab3045cf2431cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.9
|
Security for zipcreator-sebastian-stigler 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.