The situtation:
I received a big rar file containing multiple log files.
I am converting each individual log file to a bzip2 archive.
What i am doing now:
Decompress the rar file completly, and only then convert all log files to bzip2 archives.
What i would like to do:
Be as efficient as possible by not storing all the uncompressed files first.
My first idea is to parse the output of unrar to distinguish when a file has been fully uncompressed, and then start a bzip2 compression on it.
How could i do that?
Since unrar supports a
pcommand to print files, something like this should work:If the archive is a “solid” archive this will not be very efficient since it will have to process all the files multiple times. Also be careful if your file names can contain spaces.