Skip to main content

portable archive file manager

Project description

Patool

Patool is an archive file manager.

Various archive formats can be created, extracted, tested, listed, searched, repacked and compared with patool. The advantage of patool is its simplicity in handling archive files without having to remember a myriad of programs and options.

The archive format is determined by the file(1) program and as a fallback by the archive file extension.

patool supports 7z (.7z, .cb7), ACE (.ace, .cba), ADF (.adf), ALZIP (.alz), APE (.ape), AR (.a), ARC (.arc), ARJ (.arj), BZIP2 (.bz2), BZIP3 (.bz3), CAB (.cab), CHM (.chm), COMPRESS (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms), FLAC (.flac), GZIP (.gz), ISO (.iso), LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar, .cbr), RZIP (.rz), SHN (.shn), TAR (.tar, .cbt), XZ (.xz), ZIP (.zip, .jar, .cbz), ZOO (.zoo) and ZSTANDARD (.zst) archive formats.

It relies on helper applications to handle those archive formats (for example xz for XZ (.xz) archives).

The archive formats TAR, ZIP, BZIP2 and GZIP are supported natively and do not require helper applications to be installed.

Examples

# Extract several archives with different formats
patool extract archive.zip otherarchive.rar

# Extract archive with password
patool extract --password somepassword archive.rar

# Test archive integrity
patool test --verbose dist.tar.gz

# List files stored in an archive
patool list package.deb

# Create a new archive
patool create --verbose /path/to/myfiles.zip file1.txt dir/

# Create a new archive with password
patool create --verbose --password somepassword /path/to/myfiles.zip file1.txt dir/

# Show differences between two archives
patool diff release1.0.tar.gz release2.0.zip

# Search for text inside archives
patool search "def urlopen" python-3.3.tar.gz

# Repackage an archive in a different format
patool repack linux-2.6.33.tar.gz linux-2.6.33.tar.bz2

Website

See https://wummel.github.io/patool/ for more info and downloads.

API

You can use patool functions from other Python applications. Log output will be on sys.stdout and sys.stderr. On errors, PatoolError will be raised. Note that extra options such as password input or customization for specific archive programs are not supported.

import patoolib
patoolib.extract_archive("archive.zip", outdir="/tmp")
patoolib.test_archive("dist.tar.gz", verbosity=1)
patoolib.list_archive("package.deb")
patoolib.create_archive("/path/to/myfiles.zip", ("file1.txt", "dir/"))
patoolib.diff_archives("release1.0.tar.gz", "release2.0.zip")
patoolib.search_archive("def urlopen", "python3.3.tar.gz")
patoolib.repack_archive("linux-2.6.33.tar.gz", "linux-2.6.33.tar.bz2")
patoolib.is_archive("package.deb")

Test suite status

Patool has extensive unit tests to ensure the code quality.

Bash completion

Install the argcomplete python package with apt-get install python3-argcomplete, then run eval "$(register-python-argcomplete patool)". After that typing patool, a and then lists available options and commands.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

patool-1.15.0.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

patool-1.15.0-py2.py3-none-any.whl (91.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file patool-1.15.0.tar.gz.

File metadata

  • Download URL: patool-1.15.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for patool-1.15.0.tar.gz
Algorithm Hash digest
SHA256 d94814a1c92d111089001f6a67b058de29ae7033e172503af1acb452048c8a69
MD5 f637d0d35ad67d7f43444e2f501281bb
BLAKE2b-256 b7b1b32e5646619d5fb3cf57e635f076146e99fb02acfcd6afad78dcda8c9bfc

See more details on using hashes here.

File details

Details for the file patool-1.15.0-py2.py3-none-any.whl.

File metadata

  • Download URL: patool-1.15.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 91.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for patool-1.15.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b14fd047571f71220de5d220bac9974fa2f423cce3c42cf0a85f54f155c30f09
MD5 5fe89fa3380b8bac5f3c51288ed8cca7
BLAKE2b-256 f4f0cee07d9fee3ac4b846fb44eca856142a7bcf44be83e221c4d698fec449d9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page