2011-12-13 98 views
0

如何使用Visual Basic.NET搜索文件夹名称(例如'xerity') 和压缩文件夹(例如'zerxeritynar','hiun xerity natrer'等)?如何使用Visual Basic.NET搜索文件夹名称和zip文件夹?

+0

在代码中?或者在IDE的一部分?请具体说明您要完成的任务。 – David

+0

它在代码中。 ... – user1095332

+0

[Basic:如何搜索文件夹并复制visual basic.net中的文件夹?](http://stackoverflow.com/questions/8486312/basic-how-search-for-a-folder -and-copy-the-folder-in-visual-basic-net) – LarsTech

回答

0

对于压缩,你可以使用从this location SharpZipLib。使用这个库来执行您的请求是非常容易的:

Dim sSourcePath As String 
Dim sTextToFind As String 
Dim sZipFileName As String 

sSourcePath = "D:\Temp" 
sTextToFind = "test" 
sZipFileName = "D:\temp\zippedfiles.zip" 

' Zip all of the found files 
Dim oArchive As New FastZip 

oArchive.RestoreDateTimeOnExtract = True 
oArchive.CreateEmptyDirectories = False 
' This uses the directory filter (last parameter) to only include the directories that match the string. 
oArchive.CreateZip(sZipFileName, sSourcePath, False, "", "*" & sTextToFind & "*") 
+0

谢谢。但在Visual Basic Express中使用时,SharpZipLib会提供20个错误。 – user1095332

+0

@ user1095332:您是在尝试构建sharpziplib库还是仅使用DLL?我强烈建议在你的情况下使用预编译的DLL。 –