For Each File
AutomatR.DefaultActivities.FileAndFolder.ForEachFile
The "For Each File" activity in AutomatR enables users to perform a series of activities on each file within a specified folder. This activity streamlines file processing tasks, allowing for efficient automation workflows.
Properties
Name | Description |
---|---|
Input | |
Filter By | Specifies the desired file extension for filtering. For example, ".docx" . String variables containing the file extension. Default is "*.*" (all files). |
In Folder | Specifies the complete path for the folder on which you wish to perform operations. String variables containing the folder path. |
Include Subfolders | Indicates whether to expand the search to include all subfolders of the selected location. Accepts Boolean values. Boolean variables or arguments. |
Misc | |
Display Name | Provides a customizable name for the activity displayed in the workflow. Enhances clarity and organization within the automation project. String variables containing the desired display name. |
Variables | Represents the index of the current iteration within the "For Each File" loop. Integer variables or arguments to store the index value. |
Optional | |
Delay | Specifies the amount of time (in seconds) to wait before executing the "For Each File" activity. Useful for handling synchronization issues. Integer variables or arguments containing the delay duration. Example: If the amount of time is 1000 milliseconds or 1 sec, i.e., 1. |
How to use:
- Drag and drop the "For Each File" activity onto the workflow.
- Configure the properties by specifying the folder path, file extension filter, and whether to include subfolders.
- Optionally, configure the delay and customize the display name.
- Define the series of activities to be performed on each file by adding activities within the Body container.
- Execute the workflow to iterate through each file in the specified folder and perform the defined actions.
Example: Consider an example where the "For Each File" activity is used to process all ".txt" files within the "D:\Data" directory:
For Each File:
Display Name: "Process Text Files"
In Folder: "D:\Data"
Filter By: ".txt"
Include Subfolders: True
Body:
- Read Text File
- Extract Data
- ...
In this example, the activity iterates through each ".txt" file in the "D:\Data" directory, executing a series of defined actions within the Body container for each file. Adjust the folder path, file extension filter, and actions as needed for your workflow.