Public Class showdirsize
'Recuperation statistics Specify all file capacity in the directory
Public Shared Function Dirsize (Byval D as io.directoryInfo) AS LONG
DIM SIZE AS long = 0
'Statistics this directory of all file capacity sum
Dim fis as it.fileinfo () = d.Getfiles ()
Dim Fi as IO.fileinfo
For Each Fi In Fis
Size = FI.LENGTH
Next Fi
'Recurrent statistics All file capacity in all subdirectories
DIM DIS IO.DIRECTORYINFO () = D.Getdirectories ()
DIM DI As IO.DIRECTORYINFO
For Each Di in DI
Size = DIRSIZE (DI)
Next di
Return Size
END FUNCTION
END CLASS
'Calling code
DIM DIR AS New System.io.directoryInfo (TXTDIR.TEXT)
TXTMESSAGE.TEXT = showdirsize.dirsize (DIR)