WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Zipper

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Finding Zip Uncompressed File Sizes

Keywords:   uncompressed size uncompressed file sizes

Question:

The l (small L) option only returns the 'size of the archive' (i.e. filesize) not the size of the uncompressed archive. It also returns the individual file sizes in the archive, so in theory I could find all of them and sum them, but I'm dealing with hundreds of files (perhaps thousands later) and the buffer fills up. The documentation for "l" says that "along with totals for all files specified" which implies this can be done with greater ease than I see.

Answer:

Sorry. No easy way to return all uncompressed file sizes inside the zip using a simple option. But here's some sample code to calculate it:
AddExtender("WWZIP34I.DLL")

xunzipper=zUnZipFiles("l", "C:\My Download Files\DumpEvtD.zip", "*.*", "","c:\My Download Files\unzip")
xunzipper=strreplace(xunzipper,@tab,@crlf)
handle1=FileOpen("c:\My Download Files\unzip\filespecs.txt","WRITE")
FileWrite(handle1,xunzipper)
FileClose(handle1) 


handle2=FileOpen("c:\My Download Files\unzip\filespecs.txt","READ")
handle3=FileOpen("c:\My Download Files\unzip\uncompressed.txt","WRITE")

while 1
   line=FileRead(handle2)
   foundit=0
   if line=="*EOF*" then break
   lookfor=StrIndex(line,"uncompressed size:",1,@FWDSCAN)
   if lookfor!=0 then foundit=1
   if foundit==1 then FileWrite(handle3,line)
endwhile


FileClose(handle2) 
FileClose(handle3)

handle4=FileOpen("c:\My Download Files\unzip\uncompressed.txt","READ")
handle5=FileOpen("c:\My Download Files\unzip\final.txt","WRITE")
while 1
   line=FileRead(handle4)
   if line=="*EOF*" then break
   newline=StrReplace(line,"uncompressed size:","") 
   newline=StrReplace(newline,"bytes","")
   newline=StrReplace(newline," ","")
   newline=StrReplace(newline,@tab,"")
   FileWrite(handle5,newline)
endwhile

FileClose(handle4)
FileClose(handle5)

handle6=FileOpen("c:\My Download Files\unzip\final.txt","READ")
sum=0
while 1
   line=FileRead(handle6)
   if line=="*EOF*" then break
   sum=line+sum
endwhile
FileClose(handle6)

message("Total bytes =",sum)

Article ID:   W14563
Filename:   Finding Zip Uncompressed File Size.txt
File Created: 2001:03:01:15:01:30
Last Updated: 2001:03:01:15:01:30