Valid on UNIX and Windows
The ChDir or SetDirectory function changes the current directory.
This miscellaneous function has the format:
ChDir(pathstring as String) as Boolean
SetDirectory(pathstring as String) as Boolean
Name of the directory.
On successful completion, the function returns TRUE; otherwise, it returns FALSE.
Example: SetDirectory function
This example creates a directory called c:\AMTest, Sets it as active directory, displays it. Then sets it as the default directory, and renames and removes it.
'Create dir
CreateDirectory("C:\AMTest")
'Set active dir
SetDirectory("C:\AMTest")
MessageBox(" Current Directory is : " + GetDirectory(0) )
'Set Default to C:\
SetDirectory("C:\")
'Rename the directory
RenameDirectory("C:\AMTest","C:\AMTest_1")
If ExistDirectory("C:\AMTest_1") THEN
RemoveDirectory("C:\AMTest_1")
Else
MessageBox("Could not find directory : C:\AMTest_1")
Endif
|
Copyright © 2013 CA.
All rights reserved.
|
|