Reputation: 197
I have retrieved all file names and store it to a string array. Following is the code:
Dim fi As System.IO.FileInfo
Dim file_size As Int32
'all file names are stored in Files string array
Dim Files() As String
Dim CurrentFile As String
For Each CurrentFile In Files
fi = New System.IO.FileInfo(CurrentFile)
file_size = fi.Length
Next
Is this the correct way of getting each file's size? Is there any better way to get file size? I have thousand of files and I'm looking for a better approach.
Upvotes: 0
Views: 257
Reputation: 1631
Yes the FileInfo classes Length Property gives you the size of the file in bytes.
Upvotes: 2