Help Centre › Building Processes
This article describes the RPA Loop functionality to each file in a folder.
For a full list of available functions, please read LOOP functions.
Description
The LOOP Each file in a folder function allows you to each file in a folder.
Setting it up
To use the LOOP Each file in a folder function, follow these instructions:
{{popups:rpas/add:action=loop-files}}
Once on a process map:
- Navigate to the process where you would like to add the LOOP Each file in a folder function
- Click on the green button’s drop-down (right side of the green button labelled “Process”)
- On the menu that appears, click on the “+ Activity” item
- From here you can select the LOOP Each file in a folder option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Folder path | Yes | Text | – | Path to the folder to loop through. |
| Variable | Yes | Text | – | Loop variable name to access the current file path. |
| Include sub-folders | No | Boolean | Off | Include files from sub-folders. |
| Max iterations | No | Number | – | Maximum number of files to process. |
Output variables
| Variable | Type | Description |
|---|---|---|
| Variable | Text | Full path of the current file in the loop. |
Errors
| Error | Description |
|---|---|
| Folder not found | The specified folder does not exist. |
| Folder is empty | The folder contains no files. |
Tips
- Use conditions after the loop starts to filter files by extension, e.g. check if {file} ends with '.xlsx'.