Posts

Showing posts from December, 2012

Programmatically Zip and UnZip the files in .NET

Normally we may find the functionality to Zip and Unzip the file pro grammatically.We have many third party components to do this operation.Here I am going to present Zip and Unzip files using "CGZipLibrary.dll" in C#.NET.

To do this we need to download the CGLibrary.dll from this link and register this dll.

The zip file contains 3 DLL's:
CGZipLibrary.dllzip32.dllUnzip32.dll Open the command prompt in administrator mode.Now we need to register this CGZipLibrary.dll as given below

regsvr32 filepath\filename

Ex: regsvr32 D:\Download\CGLibrary.dll

After registering the dll and Copy zip32.dll and unzip32.dll to

c:\windows\system32 directory or c:\winnt\system32.

Unzip the file you need to do like this

 string SrcPath = @"D:\StudentReports.zip";
            string DestPath = @"D:\ZippedFiles";             try             {                 CGUnzipFiles oUnzip = new CGUnzipFiles();                 oUnzip.ZipFileName = SrcPath;                 oUnzip.ExtractDir = …