Skip to content

Get_Directory

See Also: File I/O Commands, File_Exist, Make_Directory, Make_Temp_File, Remove_Directory, Valid_Drive

Purpose

To obtain the current working folder for a given drive letter.

Syntax

Get_Directory [{drive}] {variable}

where:

  • {drive} is the letter designating the disk drive. You may terminate the variable with a colon, ':', if you wish. That is, both "C" and "C:" are acceptable values for drive. If the {drive} parameter is omitted, the current drive is assumed.

What It Does

Get_Directory returns the current working folder in {variable} for a given drive.

Example

This sample shows how to get current folders for all valid drives.

String sFolder
Integer i  // Counter for all drives.
Integer bInvalidDrive

// Retrieve the current folder.
For i From 65 To 90 // A to Z
    // Check if drive is OK.
    // Note: Can still have a media not ready error.
    Valid_Drive(Character(i)) bInvalidDrive
    If (Not(bInvalidDrive)) Begin
        Move "" to sFolder // Reset the value
        Get_Directory(Character(i)) sFolder
        Showln "Current folder for drive " ;
            (Character(i)) " is " sFolder
    End
Loop

Notes

  • If the specified drive does not exist or contains bad media, an error is reported.