Scripting Runtime Library  

TotalSize Property

Returns the total space, in bytes, of a drive or network share.

object.TotalSize 

The object is always a Drive object.

Remarks

The following code illustrates the use of the TotalSize property:

[JScript]
function SpaceReport(drvPath)
{
   var fso, d, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   d = fso.GetDrive(fso.GetDriveName(drvPath));
   s = "Drive " + drvPath + " - ";
   s += d.VolumeName + "<br>";
   s += "Total Space: "+ d.TotalSize/1024 + " Kbytes <br>";
   s += "Free Space:   " + d.FreeSpace/1024 + " Kbytes";
   return(s);
}
[VBScript]
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

See Also

AvailableSpace Property | DriveLetter Property | DriveType Property | FileSystem Property | FreeSpace Property | IsReady Property | Path Property | RootFolder Property | SerialNumber Property | ShareName Property | VolumeName Property

Applies To: Drive Object