[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
DISKSPACE()

    DISKSPACE() determines the number of available bytes remaining on the
    specified disk drive.

Syntax

    DISKSPACE([<expN>])

Argument

    <expN> is the number of the drive to query where one is drive A, two is
    B, and three is C, etc.  The default is the current drive if <expN> is
    omitted or zero.

Returns

    An integer numeric value.

    DISKSPACE() returns the number of bytes of empty space on the specified
    disk drive.  If DISKSPACE() is specified without an argument, the
    return value reflects the amount of space available on the default
    drive.  It does not honor the SET DEFAULT drive.

Usage

    DISKSPACE() is useful when COPYing or SORTing to another drive and you
    want to determine if there is enough space available before initiating
    the operation.  A variation of this concept is to use DISKSPACE() in
    combination with the RECSIZE() and RECCOUNT() functions to create a
    procedure to automatically backup database files.

Example

    The following is a user-defined function that uses DISKSPACE() to
    backup a database file to another drive:

    FUNCTION BackUp                                    
    PARAMETERS outfile, drive                          
    *                                                  
    needed = INT((RECSIZE() * LASTREC() + HEADER() + 1)
    IF DISKSPACE() < needed                            
       RETURN .F.                                      
    ENDIF                                              
    COPY TO &drive.:&outfile.                          
    RETURN .T.                                         

See Also: LUPDATE LASTREC RECSIZE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson