Reputation: 2157
I am using zip
to archive a lot of files. There are a few files I have that are small (they just contain one decimal number stored on one line). After operating on these files, zip
reports stored 0%
. Not deflated 0%
, but stored 0%
. I am wondering if this means that my subsequent zip archive will not have these files stored. If so, is there any way I can fix it so zip
will store them? Is it because the files are so small?
Upvotes: 35
Views: 31494
Reputation: 4139
Do you run zip with recursion option?
zip -r output.zip folder
Without -r
, the zip will not compress with sub-directories and lead to deflated 0%.
Upvotes: 55
Reputation: 4069
When zip
add a file, it will compress it if it makes sense.
If the file is big enough, zip
will use the compression algorithm DEFLATE
(and print "deflated" and the % gained with the compression).
For very small files the compression will make the result bigger (for example, if I manually deflate a file with 2 bytes, I will get 4 bytes) so zip
decides to STORE
them (no compression) : it prints "stored" and 0% because this "compression" didn't change the size. zip
will also STORE
folders (no content).
You can easily play with the compression : zip -0
will STORE
everything, zip -1
to zip -9
will change the compression level of DEFLATE
and zip -Z bzip2
will change the compression method.
So, to answer to your question : the stored 0%
is fine ! The file has been added but not compressed.
Upvotes: 56