A simple script to compress files using the very powerful PAQ8PX compression software

A simple script to compress files using the very powerful PAQ8PX compression software

Hi everyone,

Today, I’d like to share with you a Python script I wrote that enables file and folder compression using the latest version of the powerful PAQ8PX compression software.

PAQ is a compression software originally developed by Matt Mahoney and released under the GPL license. It has a lot of contributors and has had lots of changes since it was originally introduced.

PAQ8PX is one of the most powerful (and slowest) compression software that is actively under development. You can read more and see the latest release at the encode.su PAQ8PX thread by clicking here.

The latest version as of this post is paq8px_v143.

This compressor can compress individual files by passing it directly to it but in order to compress folders or more files, you need to create a text file specifying the files that it will compress. That’s where my script comes useful.

This script will recursively check for files and folders and create a text file. It will then pass this file to paq8px in order to it to compress. Also, it can automate testing the archive by passing the -t or --test argument.

You can see the script in action in the image below:

PAQ8PX Python Script 1

In the above image, you can see it generated the file list and launched paq8px_v143.exe to compress the folder located G:\ called 5-17-2018 by using the generated file list.

And now, you can see the script launched paq8px_v143.exe to test the archive because we passed the -t argument:

PAQ8PX Python Script 2

Here’s a sneak peak of the script code:

PAQ8PX Python Script 3

Usage:

If you just want to compress files using the defaults, just use

python paq8px_script.py -i INPUT -t

The above like will compress the specified file or folder and then test the archive. If you don’t want to test the archive, simply remove the -t argument, but this is not recommended as PAQ is experimental.

If you want to override the default arguments, you must specify the argument with the corresponding value. Arguments that can be overridden are the following:

  • -v or --version: Specify a PAQ8PX version other than the default. Just pass the number of the version you want to use. Default is 143 which uses paq8px_v143.
  • -l or --level: Specify the compression level and switches to use. Refer to the PAQ8PX help to know the different switches. Levels ranges from 0 to 9. Default is 9 for maximum compression and uses the a switch, so the default is actually 9a.
  • -o or --output: Specify the output archive name and location. The default it the parent folder name.

In addition to overriding those arguments, you can use the following optional arguments:

  • -t or --test to test the archive after compressing it.
  • -r or --remove to remove the file list after compressing and testing. It is by default not deleted in case you want to test the archive later.

Requirements to use the script:

For more information, refer to the project repository and its Readme document. The link is at the start of this post.

PAQ8PX Python Script 4

Download

Get the script on GitHub here.

That’s all! Hope you like the script!