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
You can see the script in action in the image below:
In the above image, you can see it generated the file list and launched
paq8px_v143.exe to compress the folder located
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
Here’s a sneak peak of the script code:
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:
--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.
--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
--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:
--test to test the archive after compressing it.
--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.
Get the script on GitHub here.
That’s all! Hope you like the script!