如何压缩和解压缩文件夹(Windows应用程序) [英] how to zip and unzip the folder (windows application )

查看:214
本文介绍了如何压缩和解压缩文件夹(Windows应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要在该文件夹中压缩一个包含大量xml文件的文件夹,并且我也需要解压缩该文件夹,该文件夹可以帮助我也很快完成此工作吗(我可以获取代码更详细的信息吗,它会更有用

我也是这个东西!

谢谢!!

我没有得到解决方案,但它的朋友们紧急PLZ试图尽快帮助我! (vb.net 2008. 2.0框架)
我需要压缩一个文件夹并解压缩一个文件夹)

hi ,

i need to zip a folder in that folder it has bulk of xml files , & also i need too unzip that folder can any one help me too finish off this stuff soon ( can i get code more detail it will be more helpful

& i new too this stuff!

thanks !!

i dont get the solution yet friends it urgent plz try to help me soon !! (vb.net 2008. 2.0 framework )
i need zip a folder and unzip a folder )

推荐答案

尝试一下

http://www.codeguru.com/vb/gen/vb_graphics/fileformats/article. php/c6743 [ ^ ]
try this

http://www.codeguru.com/vb/gen/vb_graphics/fileformats/article.php/c6743[^]


hi,


它对vb.net有用吗!



thnks
hi ,


Does it work for vb.net!!



thnks


到目前为止,我体验过的.NET最佳的zip/unzip实用程序是DotNetZip.它是您可以在项目中引用的第三方类库.
您可以在此处下载DotNetZip:




http://download.codeplex.com/Download?ProjectName=dotnetzip& DownloadId = 258012& FileTime = 129571576121970000& Build = 18207




将其解压缩到您PC上的目录中.您将DLL(ionic.zip.dll)添加到项目中(将其添加为引用),然后可以将文件压缩到目录中,如下所示:




The best zip/unzip utility for .NET that i''ve experienced so far is DotNetZip. It is a third party class library that you can reference in your project.
You can download DotNetZip here:




http://download.codeplex.com/Download?ProjectName=dotnetzip&DownloadId=258012&FileTime=129571576121970000&Build=18207




Extract it to a directory on your pc. You add the DLL (ionic.zip.dll) to your project (you add it as reference) and then you can zip files within a directory, just like this:




''Set filename to save your new zip file

Dim zipFileName As String = "C:\MyZipFile.zip"


''Set the path to directory containing the files you want to zip
Dim fileNames As String() = Directory.GetFiles ("C:\User\Name\Document\FilesToZip\") 

Using zip As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile 


''Add all the files in that directory to zip
For Each file In fileNames

zip.AddFile(file)

Next 


''save the newly created zip file in the path you specified above
zip.Save (zipFileName) 

End Using 



希望对您有帮助.

最好的问候.



hope it helps.

Best Regards.


这篇关于如何压缩和解压缩文件夹(Windows应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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