changeset: 104874:0c8ffa562f3a parent: 104870:a6a79053aec4 parent: 104873:843538a4094b user: Serhiy Storchaka date: Wed Nov 02 12:13:48 2016 +0200 files: Doc/library/zipfile.rst Misc/NEWS description: Issue #28513: Documented command-line interface of zipfile. diff -r a6a79053aec4 -r 0c8ffa562f3a Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst Wed Nov 02 18:47:24 2016 +0900 +++ b/Doc/library/zipfile.rst Wed Nov 02 12:13:48 2016 +0200 @@ -632,4 +632,64 @@ 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 + + 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 diff -r a6a79053aec4 -r 0c8ffa562f3a Misc/NEWS --- a/Misc/NEWS Wed Nov 02 18:47:24 2016 +0900 +++ b/Misc/NEWS Wed Nov 02 12:13:48 2016 +0200 @@ -374,6 +374,11 @@ PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and PyUnicode_AsEncodedUnicode(). +Documentation +------------- + +- Issue #28513: Documented command-line interface of zipfile. + Build -----