Command line utilities for creating zip files
Project description
zip-files
Command line utilities for creating zip files.
Provides the zip-files and zip-folder command line utilities. These are intended as an easy platform-independent tool to create zip files with an arbitrary file name and an arbitrary root (the top-level folder after extracting a zip) from files and folders at arbitrary locations on the file system.
Typical usage includes:
Deploy zip archives of Sphinx-documentation while releasing Python packages:
zip-folder --auto-root --outfile docs/_build/artifacts/mypackage-v1.0.0.zip docs/_build/html
creates a file mypackage-v1.0.0.zip in docs/_build/artifacts that unzips as a folder mypackage-v1.0.0 containing the files originally in docs/_build/html/.
Create zip files pulled together from different locations, for emailing:
zip-folder -a -o report.zip ./report2020-01.tex /scratch/project/plots/*.pdf
creates a file report.zip that unzips as a folder report containing the file report2020-01.tex and all the pdf files originally in /scratch/project/plots/.
zip-folder -f report2020-01 -o report.zip ./report2020-01.tex /scratch/project/plots/*.pdf
does the same, but unzips as a folder report2020-01 instead of report.
Development of zip-files happens on Github.
Installation
To install the latest released version of zip-files, run this command in your terminal:
pip install zip_files
This is the preferred method to install zip-files, as it will always install the most recent stable release. It will result in the executable commands zip-files and zip-folder being added to your environment’s bin folder.
Usage
zip-files
Usage: zip-files [OPTIONS] [FILES]...
Create a zip file containing FILES.
Options:
-h, --help Show this message and exit.
--version Show the version and exit.
--debug Activate debug logging.
-f, --root-folder ROOT_FOLDER Folder name to prepend to FILES inside the
zip file.
-c, --compression [stored|deflated|bzip2|lzma]
Zip compression method. The following
methods are available: "stored": no
compression; "deflated": the standard zip
compression method; "bzip2": BZIP2
compression method (part of the zip standard
since 2001); "lzma": LZMA compression method
(part of the zip standard since 2006).
[default: deflated]
-a, --auto-root If given in combination with --outfile, use
the stem of the OUTFILE (without path and
extension) as the value for ROOT_FOLDER
-o, --outfile OUTFILE The path of the zip file to be written. By
default, the file is written to stdout.
zip-folder
Usage: zip-folder [OPTIONS] FOLDER
Create a zip file containing the FOLDER.
Options:
-h, --help Show this message and exit.
--version Show the version and exit.
--debug Activate debug logging.
-f, --root-folder ROOT_FOLDER Folder name to use as the top level folder
inside the zip file (replacing FOLDER).
-c, --compression [stored|deflated|bzip2|lzma]
Zip compression method. The following
methods are available: "stored": no
compression; "deflated": the standard zip
compression method; "bzip2": BZIP2
compression method (part of the zip standard
since 2001); "lzma": LZMA compression method
(part of the zip standard since 2006).
[default: deflated]
-a, --auto-root If given in combination with --outfile, use
the stem of the OUTFILE (without path and
extension) as the value for ROOT_FOLDER
-o, --outfile OUTFILE The path of the zip file to be written. By
default, the file is written to stdout.
History
0.2.0 (2020-01-17)
Added: option --auto-root
0.1.0 (2020-01-17)
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for zip_files-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f91afa0699864648bcfb51e7e83bdfeec98b959f0051ea780febe6fd7c0ee100 |
|
MD5 | 3c043142750fb56ab993050818e9461f |
|
BLAKE2b-256 | db67d88ae4e520341eed7d238f4337eedbbc18c20100d5e114fe5eaea446a879 |