Property: FreeSpace for Drive
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: FreeSpace for Drive
Property: FreeSpace for Drive
Specifies the size of the free memory of a drive.
Object.FreeSpace
| Object | Drive Object with this property |
| Object.FreeSpace | Variant with read access Returns the size in bytes. |
The values returned by the FreeSpace property and the values returned by the AvailableSpace property are usually the same. Differences can occur in systems that support quotas.
The following example returns the free memory space of all drives:
Function CreateDriveSpaceList 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.FreeSpace,0) Else sOutput = sOutput & "[Not ready]" End If sOutput = sOutput & VBCrLf Next CreateDriveSpaceList = sOutput End Function