Removes a single folder or tree of folders. If the folder specified contains sub-folders, they will also be removed. Commonly used to automate the process of removing empty, unused or old folders.
Declaration
<AMREMOVEFOLDER FOLDER="test" TORECYCLE="YES/NO" RESULTDATASET="text" />
Example
In this example, 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>
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, About Datasets
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. |
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. |
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
The Error Causes tab allows you to select/omit specific errors that should cause a particular step to fail.
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
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.