tarfile
The tarfile
module is included in the core Python distribution as a portable
utility for reading and writing tar archives. This module is especially convenient for z/OS users to
transparently handle commonly used compressed tar archives, which are currently not available in the
native tar
tool.
For more information about tarfile
, see tarfile in the official Python documentation.
You can extract compressed archives by using
tarfile
as a single operation in
the following ways:- In command-line mode:
python3 -m tarfile -e archive.tar.gz
- In a Python script:
import tarfile tar = tarfile.open("archive.tar.gz") tar.extractall() tar.close()
Processing the above archive using native z/OS tools would involve multiple steps using
tar
and gzip
.