Previous Topic: GetDir or GetDirectory - Get the Name of the Current DirectoryNext Topic: GetDiskSize, GetDiskSizeB, GetDiskSizeKB, and GetDiskSizeMB - Return the Disk Size


GetDiskFree, GetDiskFreeB, GetDiskFreeKB, and GetDiskFreeMB - Return Free Disk Space

Valid on Symbian OS, Windows and Windows CE.

Function format:

GetDiskFree(drivenumb1 as Integer) as Integer
GetDiskFreeB(drivenumb1 as Integer) as Integer
GetDiskFreeKB(drivenumb1 as Integer) as Integer
GetDiskFreeMB(drivenumb1 as Integer) as Integer
drivenumb1

Indicates the drive number. Use 0 for the default, 1 for A, 2 for B, and so on.

The functions return the size in a 32-bit integer format. Large disks may exceed the capacity of such a representation, resulting in wrong sizes or negative values due to truncation.

Each function returns an integer, which is the free disk space, as follows:

GetDiskFree

Free disk space value in KB.

GetDiskFreeB

Free disk space value in bytes.

GetDiskFreeKB

Free disk space value in KB.

GetDiskFreeMB

Free disk space value in MB.

Note: The GetFileStoreFree function is portable and should be used in preference to GetDiskFree functions.

Example:

Rem

Rem This displays all information about the current drive in KiloBytes
Rem 
Dim drive AS Integer

drive = GetDrive()

Print("Current drive is  : " + Str( drive ) )
Print("Current drive Size : " + Str( GetDiskSizeKB( drive )) + " KB"))
Print("Current drive Free : " + Str( GetDiskFreeKB( drive ))