Solved

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

Posted on 2012-03-30
3
461 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
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now