Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to compress the file that is already compressed?

Example: Given a compressed file such as file.zip, would it be possible to gzip it into another compressed file in UNIX like this:

gzip file.zip

share|improve this question
3  
Have you tried it? Why do you think it wouldn't work, technically? (Logically it does not make sense to do what you want, but…) –  slhck Aug 7 '13 at 6:45

2 Answers 2

up vote 0 down vote accepted

Why should this not be possible?

Yes you can compress an already compressed file.

The result will vary depending on the source files and the compression algorithms used.

E.g. zip compresses every file itself and puts this files together into a container. If the compressed files have a large redundancy then it is possible that gzip or bzip2 can compress the .zip file even further. If you have no redundancy in your files it is also possible the the target file becomes bigger.

share|improve this answer

First off, yes, you can store one archive inside of another archive file. This is where a definitive "yes" to your question ends.

It could be possible to further compress the compressed data, but you can't do it with any of the common tools (ZIP, RAR, LHA, GZ, 7z, etc). Instead you would need a tool specifically designed to further compress your compressed data.

However, most people looking into file compression aren't looking at this specifically as they are looking into ways to make the general compression tools work better on different common file formats, so you are unlikely to find a practical tool to do this. Instead you should look at your compression tool's options and set it to use the maximum compression it supports instead to minimize the size of your data.

TL;DR

No, you can't.

share|improve this answer

Your Answer

 
discard

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.