Can Double Zipping Cause Problems?

29

3

I have a directory that I have been storing a ton of files in. Among the 10ish types of files there are also .zips of other directories.

In my personal experience I vaguely remember issues when trying to zip zips (ha zip zips).

Will compressing an already compressed file cause immediate problems, or potentially problems later on when I attempt to uncompress it?

I read Can zipping a file break it?, but it does not really address the zipping of zips. I did notice that corruption can cause zips to break. Would zipping zips potentially corrupt files?

sealz

Posted 2012-03-08T18:12:25.663

Reputation: 2 034

3Ouch my feelings are shattered due to a downvote – sealz – 2012-03-08T18:25:07.300

Answers

44

Zipping zips is fine. If there is a problem, that would be a bug in the compression software :).

You will probably not get any further compression for those files though unless you're using a higher level of compression.

Lars Kotthoff

Posted 2012-03-08T18:12:25.663

Reputation: 1 447

2Well, there are different levels of compression. If you've just used the "package" method on the zips in the folder you're zipping, which doesn't compress anything, you may get compression on the files. If you used maximal compression on the zips to be zipped you probably won't get any more compression. Then again, if the maximally zipped zips you're zipping share compressable content with other files in the folder getting zipped, you'll get compression. So that "obviously" bit probably isn't exactly accurate. Everything else is though. – music2myear – 2012-03-08T18:16:39.843

11the zip format compresses each file individually, so zipping a zip file actually can save some space; particularly the metadata is effectively uncompressed, and will be compressed in the zipped-zip. Probably the very best compression possible is by using no compression to collect the individual files into a single archive and then using maximum compression to reduce the single-archive size. This is basically the same idea with the .tar.gz format. – SingleNegationElimination – 2012-03-08T21:24:14.680

1Zipping a zip can gain you more space even if the compression is the same. – m4tt1mus – 2012-03-09T01:02:47.210

10

Zipping a zip might confuse AV software. There are zips, which contain themselves as a new zip of themselves, which leads to an endless recursion if your AV software tries to inspect a zip in a zip, and to avoid such an recursion, the AV software might make a false alarm.

Tools which search in zips like zgrep will not inspect zips in zips. But if you are aware of it, this might not be such a problem.

The compression result can suffer. Think of 2 zipfiles:

a.zip
- a.txt 
- b.txt 

b.zip
- b.txt

a.zip and b.zip can be very different and hard to compress further. If zipping

combined.zip
-a/a.txt
-a/b.txt
-b/b.txt

both b.txt-files can be compressed very good.

So deflating internal zips before compressing the whole thing might lead to smaller results, but more importantly, it leads to better usable results.

user unknown

Posted 2012-03-08T18:12:25.663

Reputation: 1 623

1+1 for mentioning additional possible problems, apart from data corruption – sleske – 2012-03-09T08:17:36.350

6

You can do that, you shouldn't see any problem but compressing a compressed folder, you won't gain a lot of compression. That's it...

r0ca

Posted 2012-03-08T18:12:25.663

Reputation: 5 474

0

I recently had a project that dealt with tar files. The resulting file contains all of the files but they are not compressed. In my opion tar files are a excelant way to archive zip files.

wburke

Posted 2012-03-08T18:12:25.663

Reputation: 1

-2

.tar files are not compressed files. .tar files are for wrapping multiple files into one. .gz files can only zip one file. So to make a multiple-file .gz compressed file, you make a .tar file and turn that into a .gz file. But there are no merits to compressing a pre-compressed file. So it makes no sense to make (for example) a .tar.gz.gz or a .zip with only .zips in it.

canine828

Posted 2012-03-08T18:12:25.663

Reputation: 1

1The original question doesn't say anything about .tar files, and .tar files aren't "for wrapping multiple files into one .gz file". And while compressing a compressed file won't give you more compression, it may be useful to include compressed files in an archive, so you only have one file to move around instead of multiple. – blm – 2016-01-14T18:25:47.977