Previous Topic: DeleteTree or DelTree - Remove a Directory TreeNext Topic: ExistFile - Check if a File Exists


ExistDir or ExistDirectory - Check if a Directory Exists

Valid on NetWare, Symbian OS, UNIX, Windows and Windows CE

The ExistDir or ExistDirectory function checks whether a directory exists.

Function format:

ExistDir(pathname as String) as Boolean
ExistDirectory(pathname as String) as Boolean
pathname

Identifies the directory path.

If the directory exists, the function returns TRUE; otherwise, it returns FALSE.

Example:

HELP_GETFILEATTRIBUTES

If Not(ExistDirectory("c:\backup")) then CreateDirectory("c:\backup")
CopyFile("c:\autoexec.bat", "c:\backup\autoexec.bat") 
RenameFile("c:\backup\autoexec.bat", "c:\backup\autoexec.bak")