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

LVL 5
CollindsouzaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.