Finding The Default Drive Free Space

Click to select the code.  Use Control-C to copy it to your clipboard. Help


The free space on the default drive can be found with the DiskFree function.  This is part of SysUtils, which should be declared in your uses clause.  The value returned is in bytes.

You can also get the free space on other drives.  DiskFree(0) returns the default drive space; but [usually] DiskFree(1) would return the space on A:. DiskFree(2) for B:, DiskFree(3) for C:, and so on.  Caution with this, though, as not all systems are configured the same way in hardware. DiskFree will return -1 if a drive is unavailable (for example, no diskette in the A: drive).

DiskFree is especially useful when checking to see if an application has room to install, or if your application uses large data or image or multimedia files that might possibly exceed available space.

FLASH! BANG! The action just never ends. You want your site to look great? You want it to stand out from the crowd? You want it to be free of smelly foot odor? Then you MUST MUST MUST have... Go here: FlashBanger's!


Copyright 2001 - 2012 by and OECCorp.
The 2012 Evolution™ is an OEC InterNET Group site.SupportNotices