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">
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.
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.
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.
Specifies an already created variable that should be populated with the next file name on each successive loop.
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:
Name: The name of the file.
Size: The file size.
CreatedOn: The file creation date.
ModifiedOn: The date the file was last modified.
AccessedOn: The date the file was last accessed.
IsFolder: Whether the file name is a folder (yes/no).
IsReadOnly: Whether the file attribute is read-only (yes/no).
IsArchive: Whether the file attribute is archive (yes/no).
IsSystem: Whether the file attribute is system (yes/no).
IsHidden: Whether the file attribute is hidden (yes/no).
IsCompressed: Whether the file is compressed (yes/no).
IsAccessible: Whether the file is accessible (yes/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.
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.
If YES (checked), specifies that the loop will include files or folders inside subfolders of the folder specified.
If YES (checked), specifies that the loop will include folders as an item to loop. By default folders are not looped.
If YES (checked), specifies that the loop will include files as an item to loop. By default, files are looped.
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:
none: the results are left in their natural order and not sorted.
ascending: the results are sorted in ascending alphabetical order.
descending: the results are sorted in descending alphabetical order.
Specifies the field to use in sorting the files. Valid only if Sorting [SORT] is set to ascending or descending.
The available options are:
file_name: the name of the file
creationdate: the date the file was created
modificationdate: the date the file was last modified
size: the file size
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).
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).
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.
This action includes the Description tab for entering a custom step description.
More on setting custom step description
This action also includes the standard Error Causes and On Error failure handling options/tabs.
More on Error Handling Options
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--->
<AMLOOP TYPE="FOLDER" FOLDER="C:\mp3" RESULTVARIABLE="currentfile" SUBFOLDERS="YES" RESULTDATASET="LoopFilesDataset">
<AMPLAYAUDIO FILE="%currentfile%" />