Skip to main content

Posts

Showing posts with the label Dotnet Code to get size of Folder including subfolders

Dotnet Code to get size of Folder including subfolders

Dotnet Code to get size of Folder including subfolders Public Shared Function GetSize(ByVal folderFullPath As String, Optional ByVal includesubFolderss As Boolean = True) As Long Dim sizeoffile As Long = 0 Dim directory As directoryInfo = New directoryInfo(folderFullPath) For Each fileInfo As System.IO.FileInfo In directory.GetFiles() sizeoffile += fileInfo.Length Next If includesubFolderss Then For Each subFolders As System.IO.directoryInfo In directory.Getdirectoryctories() sizeoffile += GetSize(subFolders.FullName) Next End If