RTI_OS_DIR Function
Description
Provides the set of methods to manage OS directories.
Syntax
SuccessFlag = RTI_OS_Dir( Method, Param1, Param2 )
Parameters
Name | Required | Description |
---|---|---|
Method | Yes | A string specifying the management function to execute. Can be one of the following (case-sensitive): * COPYDIR * DIREXISTS * GETTEMPDIR * MAKEDIR * MOVEDIR * REMOVEDIR * RENAMEDIR See the Methods section below for details on each method. |
Param1 | Maybe | Method-dependent parameter. See below for details. |
Param2 | Maybe | Method-dependant parameter. See below for details. |
Returns
The return value depends on the method. Most methods return TRUE$ if successful, or FALSE$ otherwise (See below). Error details are always returned via the Set_Status() stored procedure.
Methods
COPYDIR method
This method copies a directory to a new location. It expects two parameters:
Param1 | Fully qualified path of the directory to copy. |
Param2 | Fully qualified path of the location to copy the directory to. |
The COPYDIR method returns TRUE$ if the directory was copied successfully, or FALSE$ otherwise. Errors are returned via Set_Status().
DIREXISTS method
This method checks to see if a directory exists. It expects one parameter:
Param1 | Fully qualified path of the directory to check. |
The DIREXISTS method returns TRUE$ if the directory exists, or FALSE$ otherwise. Errors are returned via Set_Status().
GETTEMPDIR method
This method returns the path of the system temporary directory. It expects no parameters and Errors are returned via Set_Status().
MAKEDIR method
This method creates a directory. The method recurses to create subdirectories as needed. It expects one parameter:
Param1 | Fully qualified path of the directory to create. |
The MAKEDIR method returns TRUE$ if the directory is created, or FALSE$ otherwise. Errors are returned via Set_Status().
MOVEDIR method
This method moves a directory to a new location. It expects two parameters:
Param1 | Fully qualified path of the directory to move. |
Param2 | Fully qualified path of the location to move the directory to. |
The MOVEDIR method returns TRUE$ if the directory was moved successfully, or FALSE$ otherwise. Errors are returned via Set_Status().
REMOVEDIR method
This method removes a directory. It expects one parameter:
Param1 | Fully qualified path of the directory to remove. |
The REMOVEDIR method returns TRUE$ if the directory is removed, or FALSE$ otherwise. Errors are returned via Set_Status().
RENAMEDIR method
This method renames a directory. It expects two parameters:
Param1 | Fully qualified path of the directory to rename. |
Param2 | Fully qualified path of the new directory name. |
The RENAMEDIR method returns TRUE$ if the directory was renamed successfully, or FALSE$ otherwise. Errors are returned via Set_Status().
Remarks
All of the methods in this stored procedure can be executed outside of Event Context. When managing directories from within Event Context then consider using the FILESYSTEM object instead.
Example
// Example use of RTI_OS_DIR methods// Declare Function RTI_OS_Dir $Insert RTI_SSP_Equates // Use the MAKEDIR method to create a directory // DirName = "c:\my_data\aug_2017" Call Set_Status( SETSTAT_OK$ ) If RTI_OS_Dir( "MAKEDIR", DirName ) Then // It's there - Process the directory ...// End Else // Failed// Call Get_Status( ErrText ) End // Use the COPYDIR method to copy a directory // DirFrom = "c:\my_data\aug_2017" DirTo = "c:\my_data\backup\aug_2017" Call Set_Status( SETSTAT_OK$ ) If RTI_OS_Dir( "COPYDIR", DirFrom, DirTo ) Then // Copied OK// End Else // Failed// Call Get_Status( ErrText ) End
See Also
FILESYSTEM object, IsEventContext, GET_STATUS(), SET_STATUS() stored procedures.