How to extract a folder from zip file using SharpZipLib?

33,144

I think it is the easier way. Default functionality (please look here for more info https://github.com/icsharpcode/SharpZipLib/wiki/FastZip)

it extract with folders.

code:

using System;
using ICSharpCode.SharpZipLib.Zip;

var zipFileName = @"T:\Temp\Libs\SharpZipLib_0860_Bin.zip";
var targetDir = @"T:\Temp\Libs\unpack";
FastZip fastZip = new FastZip();
string fileFilter = null;

// Will always overwrite if target filenames already exist
fastZip.ExtractZip(zipFileName, targetDir, fileFilter);
Share:
33,144
dsp_099
Author by

dsp_099

Updated on December 15, 2020

Comments

  • dsp_099
    dsp_099 over 3 years

    I have a test.zip file which contains inside a Folder with a bunch of other files and folders in it.

    I found SharpZipLib after figuring out that .gz / GzipStream was not the way to go since its only for individual files. More importantly, doing this is similar to using GZipStream meaning it will create a FILE. But I have whole folder zipped. How do I unzip to a

    For some reason the example unzipping here is set to ignore directories, so I'm not totally sure how that is done.

    Also, I need to use .NET 2.0 for accomplish this.