Navigation:  Actions > Files >

Process Files Action

Previous pageReturn to chapter overviewNext page

The Process Files action creates a step to process multiple files in a folder (and optionally in subfolders) that match a given file mask.  This action generates a list of all files matching the specified criteria, and then performs all child steps once for each file that matches.  Create one or more child steps of any type (including Subroutine Call actions) and use the macros defined below to operate on each matching file.


Folder: The folder to search for files in.


Recursively search sub folders: If checked, any sub folders of the main folder are also searched for files.


Process once for each folder: If this option is checked, rather than once for each file, the child steps are invoked once for each folder that contains one or more matching files.


Process empty folders: If checked, even empty folders will be matched/processed (enabled only if Process once for each folder is checked).


Fail step if no matching files found: If checked and no matching files are found, the step will fail instead of being skipped when building.


Log matches found while searching: If checked, each matching file is logged while scanning for matching files (filenames are also logged for each iteration when child steps are being processed even when this option is unchecked).


Files to process: Specifies the files and folders to include or exclude.


Attributes Tab


Each child step is built once for each matching file, and the following system macros are defined for each matching file:


PROCFILES_FULLPATH: The full path and filename of the matching file (system macro).
PROCFILES_FILENAME: The base filename without path.
PROCFILES_FILE_DIR: The relative directory (if any) from the root folder.
PROCFILES_ROOT_DIR: The root directory that was specified in the Folder field.
PROCFILES_COUNT: The number of matching files for the last Process Files action.
PROCFILES_CURRENT: The index of the current file being processed (1-based).


The above macros can be used in child steps to process each file that matches the search.



See the Chain, Recurse, and Script samples for examples of the Process Files action.
This is an iterative action which repeats once for each matching file.  If used with the Rebuild Selected build action or Test button, the matching files will be logged, but the child steps will not be processed once for each matching file; see the Methods of Building help topic for other ways to test iterating steps.
A Process Files action must be a child of a subroutine step (it can't be the subroutine entry point). Use a Group action as the subroutine entry point and the Process Files step as a child of it.