Solved

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

Posted on 2012-03-30
3
464 Views
Last Modified: 2012-03-30
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
0
Comment
Question by:Dynotoe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 37788928
You can use the open source ICSharpZip library.

http://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx

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.
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 37788947
Hi Dyno,

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

For example you can look here :
http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/e2194ba9-4e87-4c10-82a9-882b31010222

Let me know if you need more help with this.

Regards,
Chinmay.
0
 

Author Closing Comment

by:Dynotoe
ID: 37789002
First to answer and you used a quick example.  Thx - D
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question