Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is a feature of the WinRAR (for Windows) archiver I love a lot: it can be set up to skip trying to compress particular files (based on their extension (name pattern)) while including them into a compressed archive. When it comes to backing up a user home directory it saves tons of time to give up trying to compress mp3, jpg, zip, etc. files and just add them to a (non-solid) archive untouched while compressing text, xls, database etc. files being added.

Having switched to Linux I still strongly prefer non-solid compressing archivers (like zip and 7z, I mostly use 7z I have switched to even before switching to Linux) over traditional tar.gz for my own convenience reasons (tar.gz advocates use to say it is needed to save rights/ownership information and links but I don't use any in my non-system files).

But I miss the WinRAR's feature to skip specific files compression a lot. May you happen to be a 7z fan too, maybe you know the way to achieve the effect?

share|improve this question

Normally this is done using tar but if you really want to skip compression set the compression level to 0.

Since I don't have the GUI and actually I don't use it you may have to write a script to do what you need for example I use PERL but you can do it any way you choose. This particular one will skip the jpg files.

my $archive = "/home/user/archive.zip";
for $file @filenames
    my $compression_level = 9;
    $compression_level = 0 if($file =~ /jpg$/);
    `7za a -tzip -mx=$compression_level $archive $file`;

You can probably get as sophisticated as you want with scripts but that's up to you.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.