RmDir

(Engine-Level Function)

Description: Destroys a directory on a disk and returns its own error code.
Returns: Numeric
Usage: Script Only.
Function Groups: File I/O
Related to: MkDir
Format: RmDir(Name [, DelAll])
Parameters:  
Name
Required. Any text expression that is the full path name of the directory to delete. A known path Known Path Aliases for File-Related Functions may be provided in the form, :{KnownPathAlias}.
DelAll
An optional parameter which, when set to 1, causes all files and sub-directories of the named directory to be deleted. Default: 0
Comments:

The return value is 0 if successful and a negative integer otherwise.

If a file lock interferes with the operation, RmDir will make 10 attempts, 100ms apart, allowing time for a temporary lock to clear.

If DelAll is not set to 1 and if the directory contains files or subdirectories, then the directory will not be deleted.

If Name is given as a relative path, then VTScada will look for that directory starting in whatever directory holds the module that is making the RmDir call. Thus RmDir("Sample"),  run from within an application that is located in the directory C:\VTScada\MyApp, will remove the directory C:\VTScada\MyApp\Sample.

Note that this behavior differs from that of the MkDir function.

Example:

err = RmDir("C:\Sample");

If possible (permissions permitting), directory Sample on the C drive will be deleted and err will be set to 0. If unsuccessful, err will be -1.