Answered by:
C# code to shows how to ZIP a folder

Question
-
Hello all,
Can anybody tell me how to write a program that can zip a folder.
Thanks in advance
Friday, July 20, 2007 7:57 AM
Answers
-
Thread.Sleep(10000) doesn't sound like the most desirable method call. Take a look at the Open Source SharpZipLib.Saturday, July 21, 2007 8:29 PM
All replies
-
Please check this link
http://www.dotnetspider.com/kb/Article3227.aspxFriday, July 20, 2007 9:09 AM -
Thread.Sleep(10000) doesn't sound like the most desirable method call. Take a look at the Open Source SharpZipLib.Saturday, July 21, 2007 8:29 PM
-
DotNetZip is a third party library that you can use in programs to handle Zip files.
try { using (ZipFile zip = new ZipFile() { // add this map file into the "images" directory in the zip archive zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images"); // add the report into a different directory in the archive zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files"); zip.AddFile("ReadMe.txt"); zip.Save("MyZipFile.zip"); } } catch (System.Exception ex1) { System.Console.Error.WriteLine("exception: " + ex1); }
Thursday, May 14, 2009 7:13 PM -
Using the Ultimate ZIP component for .NET is another way. It zips folders and files with only single line of code. Information about this library can also be found at its web blog.Thursday, April 22, 2010 9:24 PM