|
|
Subject:
Linux - trying to find size of a zipfile without actually making it
Category: Computers > Operating Systems Asked by: davidfilmer-ga List Price: $3.00 |
Posted:
24 Jun 2003 23:33 PDT
Expires: 02 Jul 2003 23:32 PDT Question ID: 221414 |
(using Info-ZIP 2.3 on MDK 9.1) I want to know how big a zipfile would be if I were to make one, but I don't actually want to make it (at least not on my filesystem). If I do this: zip -q whatever.zip *db or this: zip -q - *db >whatever.zip I get a file 6911 bytes long (and I expect these results to be the same). But I don't actually want to make the zipfile on my filesystem (even temporarily). So I try this: zip -q - *db |wc -c and it tells me it's 7231 bytes. Hmmmm. Shouldn't that be 6911??? |
|
There is no answer at this time. |
|
Subject:
Re: Linux - trying to find size of a zipfile without actually making it
From: aurelus-ga on 28 Jun 2003 13:28 PDT |
Hi davidfilmer-ga Interesting question! With the help of the InfoZip man page (man zip), I found that the program behaves differently in two situations. The first situation is when the output is sent to a file or to the terminal, the second when zip is used as a filter. In the second situation, it writes a different type of file: zip archives created in this manner can be extracted with the program funzip which is provided in the unzip package, or by gunzip which is provided in the gzip package. If you would have done zip -q - *db | dd of=whatever.zip then the resulting file would be of the length that wc reports. I couldn't find a way to directly let zip write the same type of file, i.e. like in situation one, but at least the different filesize isn't an error or so. Regards, aurelus-ga |
Subject:
Re: Linux - trying to find size of a zipfile without actually making it
From: davidfilmer-ga on 02 Jul 2003 23:32 PDT |
aurelus, thanks for your comments. Your information proved accurate, and highlighted a somewhat frustrating aspect of InfoZIP (ie, that in order to generate a 'real' zipfile that matches the filesize of the calculated value, I would be forced to use a 'compatibility' mode that reduces the effeciency of the algorythm). Unfortunately, since you don't appear to be a researcher, you can't get "official" credit or payment for your assistance, but you have my sincere appreciation. FWIW, your assistance actually helps me develop a Scouting website (http://troop606.com) which is a functional prototype of an open-source project (http://scoutsite.net). The photo galleries offer a "download everything as a zipfile" option, where the zipfile is built and provided on-the-fly. But it's nice to tell people how big it would be BEFORE they actually download it. Thanks again! |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |