使用
TotalSize = 0 '重置计数
Dim TheSize As Long = GetDirSize("D:\Publish")
Output.Show(TheSize/1024/1024)
全局代码
Public TotalSize As Long
Public Function GetDirSize(RootFolder As String) As Long
Dim FolderInfo = New IO.DirectoryInfo(RootFolder)
For Each File As IO.FileInfo In FolderInfo.GetFiles : TotalSize += File.Length
Next
For Each SubFolderInfo As IO.DirectoryInfo In FolderInfo.GetDirectories : GetDirSize(SubFolderInfo.FullName)
Next
Return TotalSize
End Function
[此贴子已经被作者于2023/11/11 12:39:12编辑过]