For Each File

This action loops through the files in a directory.

The action loops through the files in the specified directory, optionally including the files contained in subdirectories as well (directly and indirectly). In each iteration, the file name of the current file, including the file path, will be stored in the selected variable.

If a file name pattern is specified, only the files whose file name matches this pattern will be included. Note that the pattern is matched against the file name without the path, and must match the entire name.

Note All For Each steps throw an error if the selected element does not contain any sub-elements to loop through. However, when using the For Each File step to loop through files in a directory, if no files are present in the directory, this is not regarded as an error, and no error is thrown.

Properties

The For Each File action can be configured using the following properties:

Directory Name

The name of the directory to loop through. The name can be specified in several ways using a Value Selector. The name must be an absolute directory name, including the drive name, if any, and the path to the directory.

Include Subdirectories

If this option is checked, the files contained in subdirectories (directly and indirectly) of the directory will be included; otherwise only files contained directly in the directory itself will be included.

File Name Pattern

If a pattern is specified here, only files whose name matches this pattern will be included. The pattern is matched against the file name without the path, and must match the entire name.

Store File Names Here

The variable in which to store the current file name in each iteration. The file name stored is the entire file name, including the drive name, if any, and the directory path.