Search Amazon:

Create ZIP files from .NET applications

The .NET System.IO namespace lets you perform most file system operations easily unless you want to compress or ZIP a file. Why couldn't the framework's Copy function simply include a Compress option? You can use NTFS file compression (see my sample) but this doesn't compress the file a heck of a lot.

A better approach is to invoke functionality from the Visual J# library. The link below allows you to download a working C# sample that I found on the web. I don't think there are any issues with me making it available here. Search for SharpZip in Google for the complete sample and a thorough discussion.

Basically, in your C# application you reference the Java Runtime vsjlib.dll and use the functionality in the java.util and java.util.zip namespaces.

The sample includes a lot of code, most of which is dedicated to the user interface. The code required to zip files is actually pretty straight forward and can easily be adapted to your needs.

Download the code

Sign In
  User Id 
  Password 


Submit Your Own Code and Articles




About TheScarms
About TheScarms

Ask me your programming questions

I read every email and answer all I can.

User Feedback: Be the first to add a comment! Items to Show:     

     
You must log in to post feedback.
Comment:    
 

If you use this code, please mention "www.TheScarms.com"

Email this page


TheScarms AppSentinel lets you securely copy protect and create evaluation versions of your software

TheScarms(tm) AppSentinel lets you quickly and easily create evaluation versions of your software and stop unauthorized copying and unregistered use of your programs!

Get your free
trial copy today!


      The World's Number 1 Web Host

© Copyright 2008 TheScarms