Solved

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

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

691 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