1.文件或文件夹遍历搜索
Private Sub Get_Directory(ByVal DirectoryPath As String)
If Directory.Exists(DirectoryPath) Then
If Directory.GetFileSystemEntries(DirectoryPath).Length <> 0 Then
Dim DirectoryItem As String
Dim DirectoryEntries As String() = Directory.GetDirectories(DirectoryPath) 'Directory.GetFiles() 获取文件
For Each DirectoryItem In DirectoryEntries
Get_Directory(DirectoryItem) 'DirectoryItem 目录名称
Next subdirectory
End If
End If
End Sub
2.利用windows搜索引擎进行文件的搜索
System.IO.Directory.GetFiles(strDriveName, strFileName, IO.SearchOption.AllDirectories)