Valid on NetWare, Symbian OS, UNIX, Windows and Windows CE
The GetDir or GetDirectory function gets the name of the current directory.
Function format:
GetDir(n1 as Integer) as String
GetDirectory(n1 as Integer) as String
Indicates the drive number.
On successful completion, the function returns a string containing the name of the current directory for the specified drive. Otherwise, it returns an empty string.
The function returns the name of the current working directory for the drive indicated by the parameter n1 (which specifies a drive number: 0 for default, 1 for A, 2 for B, and so on).
Note: On UNIX platforms "n1" has no meaning.
Example:
This example creates a directory, sets the active directory to it, and gets the name the name of the directory. The example sets the default directory to C:\ and changes the name of the directory created. If the directory exists (that is, it was not renamed), it is deleted.
'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 © 2014 CA Technologies.
All rights reserved.
|
|