diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-02 10:11:32 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-02 10:11:32 (GMT) |
commit | d8d9da04b79a2be640af6bbd0b27d625e77806ae (patch) | |
tree | 7fd6b7fdbe994887245be135534e020a7894a6fc /Doc | |
parent | 93f26f794d2a6661780c74089c77fd841fc9920f (diff) | |
parent | 92c1a90462df5af2d5725f9b3faa5cc8f91dfbb6 (diff) | |
download | cpython-d8d9da04b79a2be640af6bbd0b27d625e77806ae.zip cpython-d8d9da04b79a2be640af6bbd0b27d625e77806ae.tar.gz cpython-d8d9da04b79a2be640af6bbd0b27d625e77806ae.tar.bz2 |
Issue #28513: Documented command-line interface of zipfile.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/zipfile.rst | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 47ba0b5..9056489 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -632,4 +632,60 @@ Instances have the following methods and attributes: Size of the uncompressed file. +.. _zipfile-commandline: +.. program:: zipfile + +Command-Line Interface +---------------------- + +The :mod:`zipfile` module provides a simple command-line interface to interact +with ZIP archives. + +If you want to create a new ZIP archive, specify its name after the :option:`-c` +option and then list the filename(s) that should be included: + +.. code-block:: shell-session + + $ python -m zipfile -c monty.zip spam.txt eggs.txt + +Passing a directory is also acceptable: + +.. code-block:: shell-session + + $ python -m zipfile -c monty.zip life-of-brian_1979/ + +If you want to extract a ZIP archive into the specified directory, use +the :option:`-e` option: + +.. code-block:: shell-session + + $ python -m zipfile -e monty.zip target-dir/ + +For a list of the files in a ZIP archive, use the :option:`-l` option: + +.. code-block:: shell-session + + $ python -m zipfile -l monty.zip + + +Command-line options +~~~~~~~~~~~~~~~~~~~~ + +.. cmdoption:: -l <zipfile> + + List files in a zipfile. + +.. cmdoption:: -c <zipfile> <source1> ... <sourceN> + + Create zipfile from source files. + +.. cmdoption:: -e <zipfile> <output_dir> + + Extract zipfile into target directory. + +.. cmdoption:: -t <zipfile> + + Test whether the zipfile is valid or not. + + .. _PKZIP Application Note: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT |