OS::SetCurrentDirectory

OS::SetCurrentDirectory(path): bool

Changes current working directory of the script process. Relative paths passed to OS::Execute() and the IO:: functions are resolved against this directory.

This function is available only in scripts run by the nxscript command line tool.

Table 1. Parameters

path

String

New working directory

Return

true if the directory was changed, false otherwise.

if (OS::SetCurrentDirectory("/tmp"))
   IO::DeleteFile("old.log"); // Deletes /tmp/old.log