Delete File Action

Description

Deletes the one or more specified files. To specify more than one file use wildcard characters (* or ?). To specify multiple files or wildcard masks, separate them with a pipe symbol (|).For example: c:\*.txt|c:\*.bak.

Declaration

<AMFILEDELETE SOURCE="text" SUBFOLDERS="yes/no" TORECYCLE="yes/no" ISNEWERTHAN="date" ISOLDERTHAN="date" EXCLUDE="text" ATTRFILTER="text" RESULTDATASET="Text" />

Examples

<AMFILEDELETE SOURCE="c:\folder1\*.*" />

 

<AMFILEDELETE SOURCE="c:\folder1\*.*" SUBFOLDERS="YES" ATTRFILTER="+r+a" RESULTDATASET="DeletionDS" />

 

<AMFILEDELETE SOURCE="c:\folder1\*.*" SUBFOLDERS="YES" SNEWERTHAN="%DateSerial(2007,02,01) + TimeSerial(20,42,51)%" RESULTDATASET="DeletionDS" />

General Tab Parameters

Source: Specifies the files to delete. 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 (* or ?) may be used to delete files matching a certain mask. Multiple files and file masks may be specified by separating the entries with a pipe symbol (|).

Text, Required
MARKUP:
a) SOURCE="c:\sourcefoldername\file.txt"
b) SOURCE="c:\sourcefoldername\*.txt"
c) SOURCE="C:\sourcefoldername\*.txt|C:\sourcefoldername\*.doc"
d) SOURCE="file.txt"

Place in recycle bin: Specifies whether to permanently delete the files or send them to the Recycle bin.

Yes/No, Optional, Default: NO
MARKUP: TORECYCLE="YES"

Create and populate dataset with result information: Specifies the name of a dataset to be created and populated with the result. In addition to the standard dataset fields, the dataset will contain the following:

  • Source: the path and file name of the source file

  • Destination: the path and file name of the destination file (blank for this action)

  • Result: the result of the action—0 for success, or an error code for failure

  • Message: textual information about the result

Text, Optional
MARKUP: RESULTDATASET="DatasetName"

Options Tab

Include Subfolders: When set to YES (selected), specifies that, if present, subfolders should be searched for files matching the mask specified in the Source [SOURCE] parameter.

Yes/No, Optional, Default: NO
MARKUP: SUBFOLDERS="YES"

Exclude Mask: Causes the action to not delete files matching the masks specified. Filenames or wildcard masks may be used. Multiple entries may be specified by separating them with a pipe symbol (|), for example: *.txt|*.bak

Text, Optional, Default: (blank)
MARKUP: EXCLUDE="*.txt"

Only if newer than: Causes the action to only delete files if the source is newer than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored (unless limited by the Only if older than [ISOLDERTHAN] parameter).

Date, Optional, Default: (none)
MARKUP: ISNEWERTHAN="%DateSerial(2007,02,01) + TimeSerial(00,00,00)%"

Only if older than: Causes the action to only delete files if the source is older than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored (unless limited by the Only if newer than [ISNEWERTHAN] parameter).

Date, Optional, Default: (none)
MARKUP: ISOLDERTHAN="%DateSerial(2007,02,01) + TimeSerial(00,00,00)%"

Click Custom to select from other time options (Last 30 seconds, Last 30 minutes, Last 24 hours, Last 30 Days, Last 12 Months, Last 5 Years, Next 30 Seconds, Next 30 Minutes, Next 24 Hours, Next 30 Days, Next 12 Months, Next 5 Years). A expression appears in the text box (e.g., %DateAdd( "s", -30, CStr( Now() ))%) and the Expression check box is selected. You can also click the Expression Builder icon to build a custom expression.

Attributes Tab

Attributes: This group of settings causes the action to filter which files are deleted based on the attribute settings of the source files. In visual mode, a group of controls are provided to assist in the selection of this parameter. In markup mode, a single text item must be specified that contains the attributes of the files you wish to delete.

Available Options:

  • R—Read-only: Specifying "+R" causes files with this attribute turned on to be included, "-R" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • A—Archive: Specifying "+A" causes files with this attribute turned on to be included, "-A" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • S—System: Specifying "+S" causes files with this attribute turned on to be included, "-S" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • H—Hidden: Specifying "+H" causes files with this attribute turned on to be included, "-H" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • C—Compression: Specifying "+C" causes files with this attribute turned on to be included, "-C" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

Text, Optional (blank)
MARKUP:
ATTRFILTER="+R+A-S-H" (delete read-only and archive files, not system or hidden)
ATTRFILTER="-S" (do not delete "system" files)