I use this code in one of my applications
public void UnZip(string pathToZipFile, string destinationPath)
{
try
{
using (Package package = ZipPackage.Open(pathToZipFile, FileMode.Open, FileAccess.Read))
{
foreach (PackagePart part in package.GetParts())
{
var target = Path.GetFullPath(Path.Combine(destinationPath, part.Uri.OriginalString.TrimStart('/')));
var targetDir = target.Remove(target.LastIndexOf('\\'));
if (!Directory.Exists(targetDir))
Directory.CreateDirectory(targetDir);
using (Stream source = part.GetStream(FileMode.Open, FileAccess.Read))
{
source.CopyTo(File.OpenWrite(target));
}
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message + " (Event: UnZip)");
}
}
If you want to see my complete code, you can find it on my blog >
http://perschluter.com/creating-zip-files-in-c-sharp/[
^]