How to calculate the total size of all files in a directory using FileInfo

  • Thread starter Thread starter Robert Homes
  • Start date Start date
R

Robert Homes

Guest
This attempt won't work:
Private Function CalculateTotalFileSize() As Integer
Dim n = 0
Dim Total = 0
Dim fInfo As FileInfo

For Each F In Directory.GetFiles(MusicDir$, "*.*", SearchOption.TopDirectoryOnly)
fInfo = New FileInfo(F)
n = fInfo.Length
Total = Total + n
Next

CalculateTotalFileSize = Total
End Function
This won't work, but I don't know enough about FileInfo to tell why.
Robert Homes

Continue reading...
 
Back
Top