Dim sSourcePath As String = txtDirection.Text.Trim
Dim sDestPath As String = ""
Dim sTextToFind As String = "搜尋指定文字資料夾"
Dim FolderName As String = ""
Dim PrinterFolderPath As String = sSourcePath
For Each sDir In Directory.GetDirectories(sSourcePath, "*" & sTextToFind & "*")
FolderName = Path.GetFileName(sDir)
PrinterFolderPath = sSourcePath & "\" & FolderName
Dim di As New DirectoryInfo(PrinterFolderPath)
'抓取資料夾中檔名,並只取PDF
For Each fi As FileInfo In di.GetFiles()
If fi.Extension.ToLower = ".pdf" Then
'資料夾中檔案副檔名是PDF的
End If
If fi.Name.ToLower.Contains("TEST") Then
'找出資料夾中的檔案名稱有包含TEST的
End If
Next
Next