DISKSPACE() Return the space available on a specified disk ------------------------------------------------------------------------------ Syntax DISKSPACE([<nDrive>]) --> nBytes Arguments <nDrive> is the number of the drive to query, where one is drive A, two is B, three is C, etc. The default is the current DOS drive if <nDrive> is omitted or specified as zero. Returns DISKSPACE() returns the number of bytes of empty space on the specified disk drive as an integer numeric value. Description DISKSPACE() is an environment function that determines the number of available bytes remaining on the specified disk drive. It is useful when COPYing or SORTing to another drive to determine if there is enough space available before initiating the operation. You may also use DISKSPACE() with RECSIZE() and RECCOUNT() to create a procedure to back up database files. DISKSPACE() ignores the SET DEFAULT drive setting. Examples . This example is a user-defined function that demonstrates the use of DISKSPACE() to back up a database file to another drive: FUNCTION BackUp( cTargetFile, cTargetDrive ) LOCAL nSpaceNeeded, nTargetDrive // nSpaceNeeded := INT((RECSIZE() * ; LASTREC()) + HEADER() + 1) nTargetDrive := ASC(UPPER(cTargetDrive)) - 64 // IF DISKSPACE(nTargetDrive) < nSpaceNeeded RETURN .F. ENDIF COPY TO (cTargetDrive + ":" + cTargetFile) // RETURN .T. Files Library is EXTEND.LIB.
See Also: LASTREC() LUPDATE() RECSIZE()