Solution:
You need to call the Windows API that resides in a system dll. See the on-line help how to declare and call DLL function.
You can call GetDiskFreeSpace or GetDiskFreeSpaceEx declared in kernel32.dll or SHGetDiskFreeSpace in shell32.dll (check the Microsoft web site for declaration of these functions).
Below is a sample GetDiskFreeSpace declaration in ATEasy:
GetDiskFreeSpace(
lpRootPathName : val string, ! root path e.g. "c:\\"
lpSectorsPerCluster: var dword, ! sectors per cluster
pBytesPerSector: var dword, !bytes per sector
lpNumberOfFreeClusters: var dword, ! free clusters
lTotalNumberOfClusters: var dword:
) : Bool
Free space is calculated as:
dFreeSpace=lpSectorsPerCluster*1.0*pBytesPerSector*lpNumberOfFreeClusters
the *1.0 in the above code is used to convert to double and to avoid overflow since the result could be >4GB