Search code examples
delphidelphi-7zlib

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


Solution

  • 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.