Remove Folder Action Icon

Remove Folder

Declaration

<AMREMOVEFOLDER FOLDER="test" TORECYCLE="YES/NO" RESULTDATASET="text" />

See Also

Split File | Move File | Create Folder | Delete File | Delete Folder | Rename Folder | Remove Folder | Touch File | Set Attributes | Read from File | Write to File | Synchronize Folders | Concatenate Files

Description

Removes a single folder or tree of folders. If the folder specified contains sub-folders, they will also be removed.

Practical Usage

Commonly used to automate the process of removing empty, unused or old folders.

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Folder

Text

Yes

(Empty)

a)FOLDER="c:\foldername\"
b)FOLDER="c:\foldername\subfoldername"

The path and name of the folder to remove. This can be a fully qualified path and file name (preferred) or a file name only (requires use of the Change Folder action). Wildcard characters (i.e. * or ?) may be used to delete files matching a certain mask. Multiple files and file masks may be specified by separating each entry with a pipe symbol (i.e. c:\*.txt|c:\*.bak).

Place in Recycle Bin

Yes/No

No

No

TORECYCLE="YES"

If set to YES, folders are sent to the Recycle Bin. If set to NO (default), folders are deleted permanently.

Create and Populate Dataset with Result Information

Text

No

(Empty)

RESULTDATASET="DatasetName"

The name of a dataset to be created and populated with information pertaining to this operation. More about the dataset that this action creates can be found below under Notes.

 

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab allows you to select/omit specific errors that should cause a particular step to fail.

More on Error Causes properties

On Error Properties

The On Error tab allows you to determine what the task should do if a particular step encounters an error.

More about On Error properties

Notes

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields. The table below describes these fields (assuming the dataset name assigned was theDataset).

Name

Type

Return Value

theDataset.Source

Text

The path and folder name name of the source folder.

theDataset.Destination

Text

Null for this action

theDataset.Result

Number

The result of this operation - 0 for success, or the corresponding error code (number) for failure.

theDataset.Message

Text

The textual information about to the result.

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: In this sample task, the Remove Folder action removes folder "C:\Temp\FoldertoDelete" to the recycle bin. A dataset named "myData" is created with status of this operation. A Send Email action sends information to the administrator regarding task result status (as returned by the dataset).

 

<AMREMOVEFOLDER FOLDER="C:\Temp\New folder" TORECYCLE="YES" RESULTDATASET="theDataset" />

<AMSENDEMAIL TO="admin@netauto.com" SUBJECT="Task Status" FROM="jo@netauto.com" REPLYTO="jo@netauto.com">Task Results - %myDatas.Result%

Result text - %myData.Message%</AMSENDEMAIL>

 

↑ Top of Page