changeset: 104871:feb6e8678512 branch: 2.7 parent: 104866:8f9c54a75c3d user: Serhiy Storchaka date: Wed Nov 02 12:05:54 2016 +0200 files: Doc/library/zipfile.rst Misc/NEWS description: Issue #28513: Documented command-line interface of zipfile. diff -r 8f9c54a75c3d -r feb6e8678512 Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst Tue Nov 01 01:44:04 2016 -0500 +++ b/Doc/library/zipfile.rst Wed Nov 02 12:05:54 2016 +0200 @@ -497,4 +497,61 @@ 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 + + List files in a zipfile. + +.. cmdoption:: -c ... + + Create zipfile from source files. + +.. cmdoption:: -e + + Extract zipfile into target directory. + +.. cmdoption:: -t + + Test whether the zipfile is valid or not. + + .. _PKZIP Application Note: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT diff -r 8f9c54a75c3d -r feb6e8678512 Misc/NEWS --- a/Misc/NEWS Tue Nov 01 01:44:04 2016 -0500 +++ b/Misc/NEWS Wed Nov 02 12:05:54 2016 +0200 @@ -236,6 +236,8 @@ Documentation ------------- +- Issue #28513: Documented command-line interface of zipfile. + - Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik Nadikuditi.