List all files under a directory
Imports System.IO
Module Module1
Sub Main()
Dim Root As New DirectoryInfo("C:\")
Dim Files As FileInfo() = Root.GetFiles("*.*")
Dim Dirs As DirectoryInfo() = Root.GetDirectories("*.*")
Console.WriteLine("Root Files")
Dim Filename As FileInfo
For Each Filename In Files
Try
Console.Write(Filename.FullName)
Console.Write(" Size: {0} bytes", Filename.Length)
Console.WriteLine(" Last use: {0}", Filename.LastAccessTime)
Catch E As Exception
Console.WriteLine("Error accessing File")
End Try
Next
End Sub
End Module
Related examples in the same category