colin
colin

Reputation: 3103

ZLib unzip a zip containing multiple files

I am using delphi 7 and need to uncompress a compressed zip file which contains multiple files, I have found examples of how to unzip a single file using ZLib but cannot find any examples of this with muliple files in the zip, would it be possible for someone to either give me an example or point me in the direction of one

thanks

Colin

Upvotes: 6

Views: 9108

Answers (2)

Erik Knowles
Erik Knowles

Reputation: 1007

If you're having problems with zlib, maybe you might want to consider TurboPower's Abbrevia (available on SourceForge). With Abbrevia, here's our multiple-file extract code:

zip.ArchiveType := atZip ;
zip.ForceType := true ;
zip.OpenArchive({...your .zip archive name});

zip.BaseDirectory :=  {...your extract path...} ;
zip.OnConfirmOverwrite := Overwrite
zip.ExtractFiles('*');

There's options to handle extraction failure, confirmation of overwrites, etc. It's a pretty nice library to work with, and it's free.

Upvotes: 13

Mark Adler
Mark Adler

Reputation: 112394

There is an example in the zlib source distribution on zlib.net. Take a look at contrib/minizip/miniunz.c .

Upvotes: 2

Related Questions