DirectoryExists

Description

Determines if the named directory exists.

Syntax

DirectoryExists ( directoryname )

Argument

Description

directoryname

String for the name of the directory you want to verify as existing

Returns

Returns true if the directory exists. Returns false if the directory does not exist or if you pass a file name in the directoryname argument.

Usage

You can use this method before attempting to move a file or delete a directory using other file system methods.

Examples

Example 1

This example determines if a directory exists before attempting to move a file to it; otherwise it displays a message box indicating that the path does not exist:

string  ls_path="monthly targets"


If DirectoryExists ( ls_path ) Then

    FileMove ("2000\may.csv", ls_path+"\may.csv" )

    MessageBox ("File Mgr", "File moved to "&

     + ls_path + ".")

Else

    MessageBox ("File Mgr", "Directory " + ls_path+&
     " does not exist" )

End If

See also