C# 使用第三方类库DotNetZip解压/压缩Zip文件
发布时间:2022-11-29 02:43:49 271 相关标签:
下载地址 http://dotnetzip.codeplex.com/
//压缩
using (ZipFile zip = new ZipFile())
{
// add this map file into the "images" directory in the zip archive 把这个PNG文件添加到zip档案的"images"目录下
zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images");
// add the report into a different directory in the archive 然后把PDF文件添加到zip档案的"files"目录下,把ReadMe.txt放到根目录
zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files");
zip.AddFile("ReadMe.txt");
// 把zip档案保存为MyZipFile.zip
zip.Save("MyZipFile.zip");
}
//解压
using (ZipFile zip = new ZipFile("MyZipFile.zip"))
{
zip.ExtractAll("c:\\myfolder", ExtractExistingFileAction.OverwriteSilently);
}
文章来源: https://blog.51cto.com/u_1236522/5880306
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报