@@ -632,4 +632,60 @@ Instances have the following methods and attributes:
632632 Size of the uncompressed file.
633633
634634
635+ .. _zipfile-commandline :
636+ .. program :: zipfile
637+
638+ Command-Line Interface
639+ ----------------------
640+
641+ The :mod: `zipfile ` module provides a simple command-line interface to interact
642+ with ZIP archives.
643+
644+ If you want to create a new ZIP archive, specify its name after the :option: `-c `
645+ option and then list the filename(s) that should be included:
646+
647+ .. code-block :: shell-session
648+
649+ $ python -m zipfile -c monty.zip spam.txt eggs.txt
650+
651+ Passing a directory is also acceptable:
652+
653+ .. code-block :: shell-session
654+
655+ $ python -m zipfile -c monty.zip life-of-brian_1979/
656+
657+ If you want to extract a ZIP archive into the specified directory, use
658+ the :option: `-e ` option:
659+
660+ .. code-block :: shell-session
661+
662+ $ python -m zipfile -e monty.zip target-dir/
663+
664+ For a list of the files in a ZIP archive, use the :option: `-l ` option:
665+
666+ .. code-block :: shell-session
667+
668+ $ python -m zipfile -l monty.zip
669+
670+
671+ Command-line options
672+ ~~~~~~~~~~~~~~~~~~~~
673+
674+ .. cmdoption :: -l <zipfile>
675+
676+ List files in a zipfile.
677+
678+ .. cmdoption :: -c <zipfile> <source1> ... <sourceN>
679+
680+ Create zipfile from source files.
681+
682+ .. cmdoption :: -e <zipfile> <output_dir>
683+
684+ Extract zipfile into target directory.
685+
686+ .. cmdoption :: -t <zipfile>
687+
688+ Test whether the zipfile is valid or not.
689+
690+
635691.. _PKZIP Application Note : https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
0 commit comments