Property: TotalSize for Drive
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: TotalSize for Drive
Property: TotalSize for Drive
Specifies the total memory space of a drive.
Object.TotalSize
| Object | Drive Object with this property |
| Object.TotalSize | Variant with read access Returns the size in bytes. |
The following example returns the total memory space of all drives:
Function CreateDriveTotalSizeList Dim fso, oMyDrive, oMyDrives, sOutput Set fso = CreateObject("Scripting.FileSystemObject") Set oMyDrives = fso.Drives For Each oMyDrive in oMyDrives sOutput = sOutput & oMyDrive.DriveLetter & VBTab If oMyDrive.IsReady Then sOutput = sOutput & FormatNumber(oMyDrive.TotalSize,0) Else sOutput = sOutput & "[Not ready]" End If sOutput = sOutput & VBCrLf Next CreateDriveTotalSizeList = sOutput End Function