Zip文件夹在C# [英] Zip folder in C#

查看:180
本文介绍了Zip文件夹在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C#中压缩文件夹的示例(简单代码)?






更新: p>

我看不到命名空间 ICSharpCode 。我下载了 ICSharpCode.SharpZipLib.dll ,但我不知道在哪里复制该DLL文件。我需要做什么来看这个命名空间?



并且你有MSDN示例的压缩文件夹的链接,因为我阅读所有MSDN,但我找不到






好的,但我需要下一个信息。



我在哪里应该复制 ICSharpCode.SharpZipLib.dll 以在Visual Studio中查看该命名空间?

解决方案

DotNetZip 帮助文件中, http://dotnetzip.codeplex.com/releases/

  using(ZipFile zip = new ZipFile())
{
zip.UseUnicodeAsNecessary = true; // utf-8
zip.AddDirectory(@MyDocuments\ProjectX);
zip.Comment =此zip创建于+ System.DateTime.Now.ToString(G);
zip.Save(pathToSaveZipFile);
}


What is an example (simple code) of how to zip a folder in C#?


Update:

I do not see namespace ICSharpCode. I downloaded ICSharpCode.SharpZipLib.dll but I do not know where to copy that DLL file. What do I need to do to see this namespace?

And do you have link for that MSDN example for compress folder, because I read all MSDN but I couldn't find anything.


OK, but I need next information.

Where should I copy ICSharpCode.SharpZipLib.dll to see that namespace in Visual Studio?

解决方案

From the DotNetZip help file, http://dotnetzip.codeplex.com/releases/

using (ZipFile zip = new ZipFile())
{
   zip.UseUnicodeAsNecessary= true;  // utf-8
   zip.AddDirectory(@"MyDocuments\ProjectX");
   zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G") ; 
   zip.Save(pathToSaveZipFile);
}

这篇关于Zip文件夹在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆