Loop Files Action


<AMLOOP TYPE="FOLDER" FOLDER="text" RESULTVARIABLE="text [variablename]" ONLYFILENAME="yes/no" SUBFOLDERS="yes/no" FOLDERS="yes/no" FILES="yes/no" EXCLUDE="text" SORT="text [options]" ISNEWERTHAN="datetime" ISOLDERTHAN="datetime" SORTON="text [options]" ATTRFILTER="text [attribute mask]" RESULTDATASET="text"> 

See Also

Loop Files Action-Setting Properties, Loop, End Loop, Loop Windows, Loop Processes, Loop Expression, Loop Dataset, Loop List, Break


Loops through the file names contained in the folder specified. The variable specified is updated with the current file name. With each successive loop, the next file name is retrieved.  The loop ends after all the file names have been retrieved or when a Break is encountered.

Practical Usage

To perform an action on every file in a folder. This action is frequently used to perform actions on files in batches, such as resizing all image files in a folder.


General Tab


Text, Required
MARKUP: FOLDER="C:\FolderName\SubfolderName"

Specifies the folder that should be scanned for files. This parameter also acts as an Include Filter and accepts wildcard characters such as * and ?. To specify more than one file, use the pipe "|" character.

Populate Variable with File Name

Text, Required

Specifies an already created variable that should be populated with the next file name on each successive loop.

Create and Populate Dataset with Result Information

Text, Optional

Specifies the name of a dataset to be created and populated with the file data for the files in the folder. In addition to the standard dataset fields, the dataset will contain the following:

Do Not Include Path Information

Yes/no, Optional, Default: NO

If YES (checked), specifies that only the file name and not the path information (drive and folder name) will be returned in the variable or dataset. If NO (default), the full path and file name will be returned.

Advanced Tab

Exclude Mask

Text, Optional, Default: (blank)

Specifies the wildcard mask that should be excluded from the loop. For example, if *.txt was specified, the loop would include all files except those that have the extension .txt.

Include Subfolders

Yes/no, Optional, Default: NO

If YES (checked), specifies that the loop will include files or folders inside subfolders of the folder specified.

Include Folders

Yes/no, Optional, Default: NO

If YES (checked), specifies that the loop will include folders as an item to loop. By default folders are not looped.

Include Files

Yes/no, Optional, Default: YES

If YES (checked), specifies that the loop will include files as an item to loop. By default, files are looped.


Text [options], Optional, Default: "none"
MARKUP: SORT="ascending"

Specifies whether a sort order should be applied to the values before the loop begins. For example, selecting ascending would return the files and/or folders in alphabetical order.

The available options are:

Field to Sort on

Text [options], Optional, Default: (file name)

Specifies the field to use in sorting the files. Valid only if Sorting [SORT] is set to ascending or descending.

The available options are:

Date Filter Tab

Only if Newer Than

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

Causes the action to look only for files newer than the date/time specified. If this 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).

Only if Older Than

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

Causes the action to look only for files older than the date/time specified. If this 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).

Attributes Tab


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

This group of settings causes the action to filter which files are included based on the attribute settings of the 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 include.

Available Options:


Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

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


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

<!---Play every MP3 file in the folder structure--->
  <AMPLAYAUDIO FILE="%currentfile%" />