我想在c#中压缩文件 [英] i want to zip a file in c#
本文介绍了我想在c#中压缩文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
先生
i希望从我的本地系统压缩文件。
i解压缩后想要更改文件的名称
sir
i want to zip a file form my local system .
i want to change the name of the file after unzip it
推荐答案
尝试使用以下库: http://sharpcompress.codeplex.com/ [ ^ ]
Try a library like : http://sharpcompress.codeplex.com/[^]
1。获取 http://dotnetzip.codeplex.com/ [ ^ ]
2.添加对DLL的引用。
3.通过以下方式导入命名空间添加:使用Ionic.Zip;
并使用以下代码
1. Get DLL for http://dotnetzip.codeplex.com/[^]
2. Add a reference to the DLL.
3. Import the namespace by adding: using Ionic.Zip;
and use the following code
using (ZipFile zip = new ZipFile())
{
zip.AddFile("C:\test\test.txt");
zip.AddFile("C:\test\test2.txt");
zip.Save("C:\output.zip");
}
希望这有帮助
Hope this helps
到目前为止我最喜欢的是
Kellerman Software的zip工具 [ ^ ]。它可以递归地解压缩包含文件的整个目录,这样就省去了一些修补。
My favorite so far is
Kellerman Software's zip tool[^]. It can unzip whole directories with included files recursively, which saved me some tinkering with those.
这篇关于我想在c#中压缩文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文