Imports System.IO
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim filePaths As String() = Directory.GetFiles("D:\Test")
Dim result As String
For Each pathFile As String In filePaths
result = Path.GetFileName(pathFile)
Next
End Sub
End Class
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim drive As String = "D:\"
Dim di As New System.IO.DriveInfo(drive)
Dim dirInfo As System.IO.DirectoryInfo = di.RootDirectory
Dim dirInfos As System.IO.DirectoryInfo() = dirInfo.GetDirectories("*.*")
For Each d As System.IO.DirectoryInfo In dirInfos
Dim a As String() = Directory.GetFiles(drive + d.Name, "*.*", SearchOption.AllDirectories)
For Each name As String In a
Dim fileName = name
Next
Next
End Sub