Function SearchFile() As ArrayList
Dim doc As String
Dim c As Integer
Dim arr As New ArrayList
c = 0
Dim path As String = Server.MapPath("").TrimEnd("\") & "\downloads\" ‘项目中指定文件夹下
doc = Dir(path, vbDirectory) ' 查找目录中第一个文件夹名称
Do While doc <> ""
' 跳过当前的目录及上层目录
If doc <> "." And doc <> ".." Then
If (GetAttr(path + doc) And vbDirectory) = vbDirectory Then '如果找到的是目录/文件夹,继续查找子项
arr.Add(doc)
c = c + 1
End If
arr.Add(doc)
End If
doc = Dir() ' 查找下一个目录
Loop
Return arr
End Sub
Dim doc As String
Dim c As Integer
Dim arr As New ArrayList
c = 0
Dim path As String = Server.MapPath("").TrimEnd("\") & "\downloads\" ‘项目中指定文件夹下
doc = Dir(path, vbDirectory) ' 查找目录中第一个文件夹名称
Do While doc <> ""
' 跳过当前的目录及上层目录
If doc <> "." And doc <> ".." Then
If (GetAttr(path + doc) And vbDirectory) = vbDirectory Then '如果找到的是目录/文件夹,继续查找子项
arr.Add(doc)
c = c + 1
End If
arr.Add(doc)
End If
doc = Dir() ' 查找下一个目录
Loop
Return arr
End Sub