ClearDirectory

Top  Previous  Next

 

The ClearDirectory command allows you to clear the contents of a specified directory. When you run the command, all files and any sub-directories along with the files are automatically deleted. Once removed, they cannot be restored unless you have a backup, so use this command with great care.

lamp Note: If the specified directory does not exist on your computer the command will consider that an error and processing of the script will cease. If you want to be sure whether or not the directory already exists you can create a Conditional command

Command Syntax

 

ClearDirectory:[TargetDirectory]

 

The colon after the command is compulsory. Any additional spaces or characters will cause an error to be thrown. The command itself is not case sensitive, but parameters may be depending on the operating system and locale.

 

Parameters:

 

TargetDirectory: The fully qualified path identifying the directory to Clear

 

The parameter is compulsory. If the parameter is missing or invalid an error will be thrown. The parameter must be surrounded by quotation marks if one or more spaces are included in the path. It is good practice to include the quotation marks in any case, so that it reduces the risk of error when writing scripts.

 

Example:

 

ClearDirectory:"C:\Test"

 

See Also: DeleteDirectory MoveDirectory RenameDirectory