Mega Code Archive

 
Categories / VB.Net / File Directory
 

FileInfo Length Property gets the size, in bytes, of the current file

Imports System Imports System.IO Public Class FileLength     Public Shared Sub Main()         Dim di As New DirectoryInfo("c:\")         Dim fiArr As FileInfo() = di.GetFiles()         Dim f As FileInfo         Console.WriteLine("The directory {0} contains the following files:", di.Name)         For Each f In fiArr             Console.WriteLine("The size of {0} is {1} bytes.", f.Name, f.Length)         Next f     End Sub 'Main End Class 'FileLength