如何使用Visual Basic.NET搜索foldernames和zip找到的文件夹?

时间:2011-12-13 15:21:43

标签: vb.net

如何搜索foldernames(例如'xerity') 和zip使用Visual Basic.NET找到文件夹(例如'zerxeritynar','hiun xerity natrer'等)?

1 个答案:

答案 0 :(得分: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 & "*")