Zip and UnZip the folder using C# [.net 4.5 feature]

I used to use some third party dll for zipping the folders. Now there is no need to use other dll, .net 4.5 gave a namespace for it.

using System.IO.Compression;

Here is the code of creating a zip folder and extracting the content from zipped folder

ZipFile.CreateFromDirectory(@”D:\Contents”, @”D:\Contents.zip”);

ZipFile.ExtractToDirectory(@”D:\Contents.zip”, @”D:\Contents”);


Happy Coding
Gopinath

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s