C# Programtically working with compressed .zip files. Opening them, working on them and recompressing them.

Hi Gents and Ladies,

I was hoping someone could show me by an example, how to uncompress a file prgrammatically so I can read in the text file, edit it and then (show me also) how to compress it back to a zipped archive file etc.

Let me please thank you in advance for your help.

Best - Dyno
Who is Participating?
You can use the open source ICSharpZip library.


Uncompress to a folder:
FastZip objFastZip = new FastZip();

objFastZip.ExtractZip("yourzipfile.zip", @"C:\uncompressfolder\", null);

Open in new window

Compress folder to zip:
FastZip objFastZip = new FastZip();

objFastZip.CreateZip("yournewzipfile.zip", @"C:\uncompressfolder\", true, null);

Open in new window

There are other options, but this is basic usage.

I hope this helps.
Chinmay PatelEnterprise ArchitectCommented:
Hi Dyno,

How about : http://www.icsharpcode.net/opensource/sharpziplib/

For example you can look here :

Let me know if you need more help with this.

DynotoeAuthor Commented:
First to answer and you used a quick example.  Thx - D
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.