2011-12-13 99 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。 –