diff -r fa275e570d52 Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst Sun Oct 23 13:32:12 2016 +0300 +++ b/Doc/library/zipfile.rst Sun Oct 23 13:35:54 2016 +0300 @@ -632,4 +632,70 @@ Instances have the following methods and Size of the uncompressed file. +.. _zipfile-commandline: + +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 current directory, use +the :option:`-e` option: + +.. code-block:: shell-session + + $ python -m zipfile -e monty.zip + +You can also extract a ZIP archive into a different directory by passing the +directory's name: + +.. code-block:: shell-session + + $ python -m zipfile -e monty.zip other-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 + --list + + List files in a zipfile. + +.. cmdoption:: -c ... + --create ... + + Create zipfile from source files. + +.. cmdoption:: -e + --extract + + Extract zipfile into target directory. + +.. cmdoption:: -t + --test + + Test whether the zipfile is valid or not. + + .. _PKZIP Application Note: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT