Siebel eScript Language Reference > Siebel eScript Commands > File I/O Methods in eScript >

Clib.chdir() Method

This method changes the current directory for the Siebel application.





The path to the directory to make current. The path can be absolute or relative.


0 if successful; otherwise, -1.


This method changes the current directory for the Siebel application. If the Siebel Server is restarted, the current directory is automatically reset as one of the following:

  • The current directory recognized by the Windows operating system on the Siebel Server
  • The home directory of the administrator who restarts the Siebel Server on UNIX

The following example shows the use of Clib.chdir() to change the current working directory of the Siebel application. The default Siebel working directory is the Siebel Root\bin directory. For example, if you installed the Siebel client in C:\sea752\client, then the default working directory is C:\sea752\client\bin.

function Application_Start (CommandLine)

   // Start Tracing

   var currDir = Clib.getcwd();
   TheApplication().Trace("Current directory is " + Clib.getcwd());

   // Create a new directory
   var msg = Clib.mkdir('C:\\Clib test');

   // Display the error flag created by creating directory;
   // Should be 0, indicating no error.


   // Change the current directory to the new 'Clib test'
   Clib.chdir("C:\\Clib test");
   TheApplication().Trace("Current directory is " + Clib.getcwd());

   // Delete 'Clib test'

   // Attempting to make a removed directory current gives an
   // error
   Clib.rmdir("Clib test");
   msg = Clib.chdir("C:\\Clib test");

Here are the trace results from the script:

Current directory is D:\sea752\client\BIN
Current directory is C:\Clib test

See Also

Clib.getenv() Method
Clib.mkdir() Method
Clib.rmdir() Method

Siebel eScript Language Reference