How to decompress entire directory (ZIP)

+1 vote
asked Sep 7, 2010 by Rebex KB (8,380 points)
edited Sep 7, 2010

Is there a way, using Rebex ZIP, to decompress an entire folder (hopefully all at once).

Applies to: Rebex ZIP

1 Answer

+1 vote
answered Sep 7, 2010 by Rebex KB (8,380 points)
edited Sep 7, 2010
 
Best answer

In case you want to extract all content of ZIP file:

// will extract whole content of myarchivive.zip to c:\temp\out\
ZipArchive.ExtractAll(
  @"c:\Temp\myarchive.zip", 
  @"c:\temp\out\",
  ArchiveActionOnExistingFile.OverwriteAll);

If you need to extract one folder from the ZIP archive and leave other folders intact try following code:

// will extract folder "first" from zip archive myarchive.zip 
// to c:\temp\out\ directory
ZipArchive.Extract(
    @"c:\temp\myarchive.zip",
    @"\first",
    @"C:\temp\out\",
    ArchiveTraversalMode.Recursive, 
    ArchiveActionOnExistingFile.OverwriteAll);
...