我想在Visual Basic中迭代文件夹中的文件。 我想检查每个文件的名称。我听说过Dir功能或其他什么,但我不太确定如何使用它..
答案 0 :(得分:6)
Imports System.IO
Dim fInfo As FileInfo()
Dim i As Integer = 0
Dim path AS String = "INSERT FILE PATH"
Dim dInfo As New DirectoryInfo = New DirectoryInfo(path)
fInfo = dInfo.GetFiles("*.txt")
Dim files As String()
Dim File As String
files = Directory.GetFiles(path, "*.txt")
For Each File In files
'Do Something With The File
i += 1
Next