Mark Morgan wrote:

Robby Russell said:


Is there a way to get the file size of a zip before it is created?

for example, I have a group of files and I add no compression and just
want to group them into an archive. I want to know what the file size of
the new zip would be BEFORE creating the zip file. Is this possible? I
don't see any flags to pass zip that would have it pretend that it is
zipping a file and producing a file size.

Any thoughts?


You could send the zip data through STDOUT and pipe through wc.

zip -q - file1 file2 | wc -c
would give you the byte count. Though I noticed in my quick test that
gives out a larger size.



I've done some tests, and it appears that for the version of zip I have on my work PC (2.3) I get the following results (using 1000 byte files as samples):


Number of files | Size of archive | Overhead | Delta
---------------------------------------------------------
1 (1000 bytes)  | 1136            | 136      | 136
2               | 2250            | 250      | 114
3               | 3364            | 364      | 114


From this data, it appears that uncompressed zip files have a 22 byte header, and add 114 bytes per file added to the archive.


Cliff
_______________________________________________
PDXLUG mailing list
[EMAIL PROTECTED]
http://pdxlug.org/mailman/listinfo/pdxlug

Reply via email to