【发布时间】:2011-07-11 22:13:30
【问题描述】:
Can any one have the idea how to zip folders (including sub files and folders like winrar doing) using C#...?
【问题讨论】:
标签: c#
Can any one have the idea how to zip folders (including sub files and folders like winrar doing) using C#...?
【问题讨论】:
标签: c#
在快速谷歌之后,我发现了这个:SharpZipLib(来自网站:#ziplib(SharpZipLib,以前称为 NZipLib)是一个完全用 C# 为 .NET 平台编写的 Zip、GZip、Tar 和 BZip2 库。)
【讨论】:
这是一个非常好的通用 .NET 实用程序,用于处理与 zip 相关的操作和文件。 http://dotnetzip.codeplex.com/
使用示例,粘贴自我刚刚提供的网站链接:
使用 (ZipFile zip = new ZipFile()) { // 将此地图文件添加到 zip 存档中的“images”目录中 zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images"); // 将报告添加到存档中的不同目录 zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files"); zip.AddFile("ReadMe.txt"); zip.Save("MyZipFile.zip"); }【讨论】: