Property: AvailableSpace for Drive
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: AvailableSpace for Drive
Property: AvailableSpace for Drive
Specifies the size of the available memory of a drive.
Object.AvailableSpace
| Object | Drive Object with this property |
| Object.AvailableSpace | Variant with read access Specifies the size in bytes. |
The following example returns the available memory space of all drives:
Function CreateDriveAvailablelSpaceList 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.AvailableSpace,0) Else sOutput = sOutput & "[Not ready]" End If sOutput = sOutput & VBCrLf Next CreateDriveAvailablelSpaceList = sOutput End Function