Subject Re: Directory verification
From Heinz Kesting <Nobody@Nowhere.com>
Date Sun, 16 Apr 2017 18:52:56 +0200
Newsgroups dbase.getting-started

Hi Charlie,
> Is it possible to verify if directories on a computer outside dbase exist?
>

More on this. While VALIDDRIVE() only checks if the specified DRIVE is
valid or present, you can use the following TRY construct to test for an
existing directory:

private cCurDir // PRIVATE is important here
cCurDir = set("DIRECTORY") // save current dir
try
    cd "D:\folder1\folder2\folder3" // example folder
    set directory to &cDir. // switch back to previous dir
catch (exception e)  // catch error if not existing
    msgbox("No such folder")
endtry

If the command CD ... is successful, the directory is actually changed,
but if you don't want this to happen right now, and only need to know if
the folder exists, then you may want to switch back to the folder you
were working in before. That's why the storage of the current folder at
the beginning.

If you need more functions for working with folders, you could use the
Windows FileSystemObject. This would provide functions like
FolderExists(), CreateExists() and DeleteFolder()

Kind regards, Heinz