by Richard Russell, October 2006
If you need to find out the amount of free space on a disk drive you can do that quite easily:
drive$ = "C:\" SYS "GetDiskFreeSpace", drive$, ^SpC%, ^BpS%, ^Free%, ^Total% gbytes_total = SpC% * BpS% * Total% / 2^30 gbytes_free = SpC% * BpS% * Free% / 2^30
This code fragment sets gbytes_total to the total capacity of the drive and gbytes_free to the free (unused) space on the drive, both in Gigabytes.
If you only want to know the free space as a percentage of the total you don't need to calculate the values in Gbytes but simply use the Free% and Total% values:
PRINT "The disk has ";INT(100*Free%/Total%+0.5);"% free space"