Set Directory
See Also: File I/O Commands, File Exist, Make Directory, Make Temp File, Remove Directory, Valid Drive
Purpose
To set the current working folder.
Syntax
Set_Directory {sVariable}
What It Does
Set_Directory sets the current working folder in variable sVariable.
Example
This example shows how to set the current directory to a folder after checking that the provided folder exists.
Procedure ChangeCurrentFolder
String sFolderName
Boolean bFolderExists
// Retrieve a folder name from a Form or other control
Get Value of oFolderName to sFolderName
File_Exist sFolderName bFolderExists
If (bFolderExists) Begin
Set_Directory sFolderName
End
End_Procedure
Send ChangeCurrentFolder
Notes
-
If the folder specified in
{sVariable}does not exist, it will trigger error 4358 DFERR_RAWFILE_ERROR. -
You can (and should) use File Exist to test if the folder exists before attempting to set the working folder to that folder.