Download ionic.Dll from(http://dotnetzip.codeplex.com/releases/view/27890)
and Add the Dll through Add reference and Add the NameSpaces (using Ionic.Zip;)
ZipFile zip = new ZipFile();
// add this map file into the "images" directory in the zip archive
DirectoryInfo f = new DirectoryInfo("c:\\images");
FileInfo[] a = f.GetFiles();
for (int i = 0; i < a.Length; i++)
{
zip.AddFile("c:\\images\\" + a[i].Name, "images");
}
zip.Save("c:\\MyZipFile.zip");
String TargetDirectory = "c:\\MyZipFile.zip";
using (Ionic.Zip.ZipFile zip1 = Ionic.Zip.ZipFile.Read(TargetDirectory))
{
zip1.ExtractAll("c:\\UnZip",
Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite);
}
Tuesday, December 28, 2010
Subscribe to:
Posts (Atom)