file.freeSpaceOnVolume

Syntax file.freeSpaceOnVolume (path)

Params path is the name of the volume on which you wish to determine the free space.

Action Determines the space remaining on the designated volume.

Returns The number of bytes free on the indicated volume.

Examples file.freeSpaceOnVolume ("C:")
349454336

file.freeSpaceOnVolume ("System:") / 1024
» 219

file.freeSpaceOnVolume ("Untitled:") / 1024
» 31

string.kBytes (file.freeSpaceOnVolume ("Untitled:"))
» 31K

file.freeSpaceOnVolume ("No such volume:")/1024
» false

This situation also produces a run-time error.

Errors Attempting to find out how many bytes are available on a non-existent volume results in an error message indicating Frontier "Couldn't find the disk volume."

Notes The file system maintains this number, so this verb requires no traversal of the directory. It is therefore fast.

Divide by 1024 (directly or using string.kBytes on the result) to display the number of kilobytes that are free. (This is usually a more manageable number.)

This verb will not return the correct result if there are more than 2 Gigabytes free on the volume. If you are running Frontier 6.1 or later, you should use file.freeSpaceOnVolumeDouble instead which will work with volume sizes of up to 4 Terabytes.

See Also file.freeSpaceOnVolumeDouble

string.KBytes

string.megabyteString

Discuss