Previous Topic: GetFileSize - Return the Size of the FileNext Topic: GetFileTime - Return File Creation Date, Last Access Date, or Last Modified Date


GetFileStoreFree, GetFileStoreSize, and GetFileStoreUsage - Return the Free Space, Total Space, and Used Space

Valid on NetWare, Symbian OS, UNIX, Windows and Windows CE

The GetFileStoreFree, GetFileStoreSize, and GetFileStoreUsage functions provide the free space, total space, and used space on the file system in KB, respectively.

Functions format:

GetFileStoreFree(filename as String) as Integer
GetFileStoreSize(filename as String) as Integer
GetFileStoreUsage(filename as String) as Integer
filename

Specifies a path to a file or directory and identifies the file system. A file system has the usual meaning in UNIX. In Windows it is a drive.

Each function returns the amount in KB.

Example:

This example lists the size, and the used and free space of drive C:\.

Dim size, free, used As Integer
Dim TAB As Char
TAB = 0x0009
ClrScr()

size = GetFileStoreSize("c:\")
free = GetFileStoreFree("c:\")
used = GetFileStoreUsage("c:\")
Print("Capacity of drive c:\")
Print("Total size" + TAB + TAB + Str(size))
Print("Free storage" + TAB + Str(free))
Print("Used storage" + TAB + Str(used))