开发者

Zipping Folders in C# [duplicate]

This question already has answers here: Closed 11 years ago.
 Can any one have the idea h开发者_如何学运维ow to zip folders (including sub files and folders like winrar doing) using C#...?


This is a pretty nice general .NET utility for handling zip-related actions and files. http://dotnetzip.codeplex.com/

An example of usage, pasted from the website link I just provided:


 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");
 }


After a quick google I found this: SharpZipLib (From the site: #ziplib (SharpZipLib, formerly NZipLib) is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜