The Loop Files action is used to loop through the file names in a specified folder, and populate a variable with the file names. You must create the variable first using a Create Variable step. This action is commonly used to perform an action on multiple files, such as resizing a batch of graphics files.
You can elect to retrieve all files in the folder, or use wildcard characters and masks to retrieve only specific types of files.
When you create a Loop Files step, an End Loop step is created automatically. Place the steps that perform the action on the files between the Loop Files step and the End Loop step. The steps within the block should be indented for visual clarity.
From the Task Builder Available Actions pane, open the Loop folder and double-click the Loop Files action or drag it into the Steps pane.
In the Folder box, click the Open Folder button and navigate to the folder that contains the files.
In the Populate variable with file name box, select the variable to populate.
To populate a dataset with the file data, enter a name
for the dataset in the Create and populate
dataset with result information box. (Dataset names must be alphanumeric,
begin with a letter, and contain no spaces.)
The dataset will show the file's name, size, date created, date modified, date last accessed, plus the state of various attributes.
If you want to use only the file names without the paths, select Do not include path information.
To set additional masks and specifications for the file selection, click the Advanced tab, and enter the properties as follows:
To include files within subfolders, select Loop through subfolders.
Use either the Include mask or the Exclude mask box to enter all or part of the file names that you want to include or ignore. If you make entries in the Include mask box, all files that do not match your entries will be ignored. If you make entries in the Exclude mask box, only the specified files will be ignored and all others will be included. You can use asterisk (*) and question mark (?) as wildcard characters.
If you want to perform the action on folders as well as files, select Include folders. If you want to perform the action only on folders and not on files, clear the Include files check box.
If you want the files looped in ascending or descending alphabetical order, make your selection in the Sorting box. By default files are looped in the order they appear in the folder.
To set the Description tab properties, refer to Description Tab Options.
To set the Error Causes and On Error tab properties, refer to Step Error Handling.
When finished, click OK to save settings and close the properties dialog window.
In the Task Builder Steps pane, hold down SHIFT and click the first and last steps in the block so that the complete block of steps is selected.
Click the Format button .
Adding Task Steps
Loop Files Action