• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

How to Create a .ZIP file from windows Forms / Windows Service

I am writing a small windows forms application.. one of the tasks is to zip all files within a particular folder. the zip file should be named as the same as the folder name. and i should then be able to transfer this zip file to a different pre-defined location.

For example:
Folder name : Folder1. in the following location C:\Test\Folder1

It contains the following files..
File1, File2, File3, File4, File5

Now i Need to compress/zip the 5 files in the folder and name it Folder1.zip (the same name as the folder name)

I then need to transfer Folder1.zip to say.. D:\Storage\ folder

I dont want to use any 3 pary software like winzip to achieve this.. However i hear that there is a new windows library called System.IO.Compression but i have'nt tried using it.. is it worth a try??

I'm using C# 2.0

Any help in this regard will be highly appreciated

0
Collindsouza
Asked:
Collindsouza
2 Solutions
 
Bob LearnedCommented:
System.IO.Compression is more for NTFS compression, and not for .zip file processing.

There is, though, some Java wrapper classes, in the vsjlib namespace that you can use to process .zip files:

java.util.zip
http://www.dotnetspider.com/namespace/ShowClass.aspx?ClassId=121

Bob
0
 
ColemssCommented:

Free Open Source Zip - I downloaded the sample project for you. Rename it.
http://www.icsharpcode.net/OpenSource/SharpZipLib/

inside the project folders - this is what you are loking for.
SharpZipLib_0854_SourceSamples\samples\cs\CreateZipFile


SharpZipLib-0854-SourceSamples.z.bmp
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now