Iterate Directory

Use this step to iterate over all entries (files, directories and other types of objects) in a directory.

This step opens an application in the Recorder View with the first entry. The entry's properties are available in the table and tree views. This step works as a loop step that iterates over the entries in the directory. Each iteration updates the contents of the views with the properties of the next entry.

The loop takes a snapshot of the entries in the directory before the first iteration and iterates through this snapshot. Changes made to the content of the directory during the loop do not affect the iteration. The application is static and does not update if the properties of the entry are changed by the steps in the loop. For example, if you deleted an entry, it will show up in the application; if you renamed an entry, it will show up using its initial name; if you created an entry, it will not show up in the application.

After all entries are iterated (or the Robot exits the loop with an exception or a Break step), the application automatically closes. It also closes if the Robot stops executing.

The Robot may use an iteration variable and Continue and Break steps to control the loop execution as the other loop steps.

Use Extract steps to extract the properties from the application tree as usual.

To enable file system access, including access to the local file system in the Local Desktop Automation mode, select the Allow File System and Command Line Access option on the Security tab in the RoboServer Settings application.

If your RoboServer is configured to forbid local file system access, the robot can run, but it produces an error if the step uses File Access set to Direct Access on the local device. However, the step can work on the local device with File Access set to Via RFS. On a remote device, both "Direct Access" and "Via RFS" can be used at all times.

The Iterate Directory step belongs to the Applications, File System, and Loop categories.

Properties

Configure the Iterate Directory step using the following properties.

Name

Name of the step.

Device
Select the reference name you want to use. This reference name is specified in the Devices property of the Call Robot step.
File Access

Specify how the file must be accessed.

To iterate over the entries in the directory on the specified local or remote device, select Direct Access.

To iterate over the entries in the directory on a robot file system, select Via RFS.

Directory Name

Specify the path to the directory from which the entries are iterated.

For example, C:\Directoryname.

Application Name

Set the name of the application the step opens.

The name specified in this required parameter is used in the application's name and title attributes.

Assign different application names to applications in a robot to avoid errors.

Iteration Variable (optional)

Specify a variable to store iteration data.