搜索文件夹通配符和打开文件夹

时间:2012-04-27 15:06:16

标签: vb.net

我无法尝试在目录中搜索带通配符的文件夹。

该文件夹看起来像这样:[2008] [560909] [市场变化]或[年] [数字] [名称]

到目前为止,这就是我所拥有的:

Function searching()

Dim choice, input
Dim strPatheServices

strPatheServices = "s:\dirr\subdirr\"
ending = true

choice = InputBox("Please choose: c for number, y for year created, n for name") 

If choice = "c" Then 
    MsgBox ("You entered: " & choice)
    input = InputBox("Please input a number:") 
    System.IO.Directory.Exists(strPatheServices\input)

ElseIf choice = "y" Then
    MsgBox ("You entered: " & choice)
    input = InputBox("Please input a year:") 
    System.IO.Directory.Exists(strPatheServices\input)

ElseIf choice = "n" Then
    MsgBox ("You entered: " & choice)
    input = InputBox("Please input a number:") 
    System.IO.Directory.Exists(strPatheServices\input)
End If

MsgBox "Done",,"Completed"

End Function

我不知道从哪里开始除了将外卡添加到存在之外如此:

System.IO.Directory.Exists(strPatheServices\input + "*")

请帮助我很困惑......

1 个答案:

答案 0 :(得分:0)

您将需要使用System.IO.Directory.GetDirectories(rootPath, wildcardPattern)并查看返回的数组是否包含多于零的元素。