DirDelete

Deletes the specified directory.

Function Group Execution Windows Embedded Thin Client
DirDelete File Synchronous Supported Supported Executed on Server

Syntax

DirDelete( strDirectory, optBooEmptyOnly )
strDirectory
The name and file path of the directory to delete.
Tip: This parameter supports wildcards ( * and ? ).
optBooEmptyOnly
Optional flag. If this parameter has a value of 1, then the directory is deleted only if it is empty. By default — that is, if the parameter is omitted or has a value of 0 — the directory is deleted whether it is empty or not.

Returned value

Value Description
−2 Attempted to delete a non-empty directory when this action is not allowed (i.e., optBooEmptyOnly does not equal 0).
−1 Invalid parameters.
0 Failed to delete the directory (i.e., directory does not exist).
1 Directory deleted successfully.

Examples

Tag Name Expression
Tag DirDelete( "C:\Studio\Temp" ) // The Temp folder from C:\Studio is deleted.
Tag DirDelete( "C:\Studio\Temp", 1 ) // The Temp folder from C:\Studio is deleted only if it is empty.