Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
DiskFree and DiskSize Functions
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
drive Integer expression in the range 0..26, representing the
drive to be checked
Return
LongInt Bytes of free space (DiskFree) or total capacity
(DiskSize) on the specified drive, or -1 if the drive
is not recognized
Description
The DiskFree function returns the number of bytes available for use
on a specified drive. The DiskSize function returns the total
capacity of a specified drive. The total capacity is the sum of the
number of bytes used and the number of bytes free.
The drive can be a floppy drive, a hard disk, or a RAM drive.
Specify the drive to be checked by passing a byte value. To
indicate the current drive, pass a drive value of 0. To indicate a
specific drive letter, pass the numeric equivalent: drive A=1,
B=2,...,Z=26.
To be able to specify the drive with a letter, use the Ord and
UpCase functions to convert the character to a byte:
result := DiskFree( Ord( UpCase( ch ) ) - 64 );
DiskFree and DiskSize return -1 if the drive is not recognized.