TotalSize Property

Office VBScript

Microsoft® Visual Basic® Scripting Edition TotalSize Property  Scripting Run-Time Reference 
Version 3 

See Also                  Applies To


Description
Returns the total space, in bytes, of a drive or network share.
Syntax
object.TotalSize

The object is always a Drive object.

Remarks
The following code illustrates the use of the TotalSize property:
Function ShowSpaceInfo(drvpath)
  Dim fso, d, s
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(drvpath)))
  s = "Drive " & d.DriveLetter & ":"
  s = s & vbCrLf
  s = s & "Total Size: " & FormatNumber(d.TotalSize/1024, 0) & " Kbytes"
  s = s & vbCrLf
  s = s & "Available: " & FormatNumber(d.AvailableSpace/1024, 0) & " Kbytes"
  ShowSpaceInfo = s
End Function