Подтвердить что ты не робот

Vb.net как перебирать список каталогов?

Как я могу прокрутить папку, в которой будут перечислены все файлы и дата/время?

4b9b3361

Ответ 1

Используйте DirectoryInfo.GetFiles() и извлеките данные (Name, CreationTime и т.д.) из класса FileInfo.

Я вставил код с страницы MSDN здесь.

Imports System
Imports System.IO
Public Class GetFilesTest
    Public Shared Sub Main()
        ' Make a reference to a directory.
        Dim di As New DirectoryInfo("c:\")
        ' Get a reference to each file in that directory.
        Dim fiArr As FileInfo() = di.GetFiles()
        ' Display the names of the files.
        Dim fri As FileInfo
        For Each fri In fiArr
            Console.WriteLine(fri.Name)
        Next fri
    End Sub 'Main
End Class 'GetFilesTest

Ответ 2

 For Each LogFile In Directory.GetFiles(Application.StartupPath & "\Txt\")

        ' do whatever wtih filename

    Next