|
|
FSO - Размер папки в MB или GB
Public Function GetFolderSize(sFolderPath$) As Currency
Dim FSO As Object, FSOFolder As Object
Dim cSize As Currency
Dim dSize As Double
On Error GoTo GetFolderSize_Err
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FSOFolder = FSO.GetFolder(sFolderPath)
dSize = CDbl(FSOFolder.Size)
cSize = dSize / 1024 ^ 3
GetFolderSize = cSize
GetFolderSize_End:
On Error Resume Next
Set FSOFolder = Nothing
Set FSO = Nothing
Err.Clear
Exit Function
GetFolderSize_Err:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in Function GetFolderSize.", _
vbCritical, "Произошла ошибка!"
Debug.Print "GetFolderSizeMB_Line: " & Erl & "."
Err.Clear
Resume GetFolderSize_End
End Function
|
|