While I have used C# and SharpZipLib to zip a directory before, I simple used the sample provided in the framework. However the sample doesn’t support maintaining the directory structure in the zip file.
So, I looked around the site very quickly and noticed a FastZip class. This has all the common scenarios like CreateZip, ExtractZip and setting a password for the zip. Very simple, but very quick to integrate and test.
There is some sample code to zip the directory ZipTest into ZipTest.zip.
ICSharpCode.SharpZipLib.Zip.FastZip z = new ICSharpCode.SharpZipLib.Zip.FastZip();
z.CreateEmptyDirectories = true;
z.CreateZip(“F:ZipTest.zip”, “F:ZipTest”, true, “”);