Archive: Determining Extracted File Size


Determining Extracted File Size
Hi,

Is there any way to determine how much space will be required for a zip file to be successfully extracted. I have a zip file on a CD that I would like to extract and install on the hard drive IF there is enough space on the hard drive. I would like to display the correct extracted space requirement on the installer. I can only get the size of the zipped file, so how do I know if there will be enough space when I unzip it?

Thanks. Great product and great Forum!!


If you are using the ZipDll plugin, check the help file for a 'getzipsize' or similar function, and execute it in .oninit. To add that size to a section, use AddSize.

Section blah
AddSize "$0" ; $0 is the variable you
; stored the size of the zip in.
SectionEnd


If you use a 3rd party command line zip tool like 7-zip or Info-Zip, you might find a function to get the size (although maybe not directly).

For example, 7zip does not have anthing that just returns the size, but if you issue this command:
7za l archive.zip > c:\temp\list.txt

you'll get the contents of the archive "archive.zip" to the file "C:\temp\list.txt") in which the the 2nd to the last line contains the total size (in bytes) of the zip archive. Once you have that, you could write a function that would open the file and read the info out of it. (Check the plugins page for some functions to help you.)

Other zip utilities might offer something similiar.

Or, if you are the one packing the zip file in the first place, just unzip the archive on your own to figure out its size and then add the size your installation as JasonFriday13 suggested.