User Guide¶
The 7z file format is a popular archive and compression format in recent days. This module provides tools to read, write and list 7z file. Features is not implemented to update and append a 7z file. py7zr does not support self-extracting archive, aka. SFX file, and only support plain 7z archive file.
Getting started¶
Install¶
The py7zr is written by Python and can be downloaded from PyPI(aka. Python Package Index) using standard ‘pip’ command as like follows;
$ pip install py7zr
When you want to use an extension that support ZStandard, please use following command line.
$ pip install py7zr[zstd]
Run Command¶
‘py7zr’ is a command script. You can run extracting a target file target.7z then command line become as such as follows;
$ py7zr x target.7z
When you want to create an archive from a files and directory under the current directory ‘d’, command line become as such as follows;
$ py7zr c target.7z d/
Command-Line Interfaces¶
The py7zr
module provides a simple command-line interface to interact
with 7z archives.
If you want to extract a 7z archive into the specified directory, use
the x
subcommand:
$ python -m py7zr x monty.7z target-dir/
$ py7zr x monty.7z
For a list of the files in a 7z archive, use the l
subcommand:
$ python -m py7zr l monty.7z
$ py7zr l monty.7z
Command-line options¶
-
l
<7z file>
¶ List files in a 7z file.
-
x
<7z file> [<output_dir>]
¶ Extract 7z file into target directory.
-
c
<7z file> <base_dir>
¶ Create 7zip archive from base_directory
-
i
<7z file>
¶ Show archive information of specified 7zip archive.
-
t
<7z file>
¶ Test whether the 7z file is valid or not.
Presentation material¶
See Introductory presentation(PDF)
,
and Introductory presentation(ODP)
.