Visual Basic: Iterate a folder's files
I would like to iterate the files in a folder in Visual Basic. I want to check for each file's name开发者_开发百科. I heard about a Dir function or something, but I am not very sure how to use it..
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
精彩评论