# tWaitForFile

Iterates on a directory and triggers the next component when the defined condition is met.

This component is used to put the component connected with it in waiting state. It then triggers that component when the defined file operation occurs in the specified directory.

Information noteNote: This component cannot be used in ESB use cases.

## tWaitForFile Standard properties

These properties are used to configure tWaitForFile running in the Standard Job framework.

The Standard tWaitForFile component belongs to the Orchestration family.

The component in this framework is available in all Talend products.

## Basic settings

| Properties | Description |
| --- | --- |
| Time (in seconds)<br>between iterations | Set the time interval in seconds between each two<br>iterations. |
| Max. number of iterations (infinite loop if<br>empty) | Set the maximum number of iterations on the specified<br>directory. |
| Directory to scan | Specify the directory to iterate on. |
| File mask | Type in the file mask to filter the files to be monitored. To<br>monitor a given file, type in the file name. |
| Include subdirectories | Select this check box to iterate also on the<br>subdirectories. |
| Case sensitive | Select this check box to activate case sensitivity. |
| Include present file | Select this check box to include the file in use. |
| Trigger action when | Select one of the following trigger conditions:<br><br><br>a file is created: triggers the<br>next component when a file is created.<br><br><br>a file is deleted: triggers the<br>next component when a file is removed.<br><br><br>a file is updated: triggers the<br>next component when a file is modified.<br><br><br>a file is created or updated or<br>deleted: triggers the next component when a file is<br>created, or removed, or modified. |
| Then | Select what to do with the iteration loop after the next component<br>is triggered:<br><br><br>continue loop: continues<br>iterating until the number of iterations reaches the defined maximum<br>value.<br><br><br>exit loop: stops iterating<br>immediately. |
| Schema and Edit<br>Schema | A schema is a row description, it defines the number of fields<br>that will be processed and passed on to the next component. The<br>schema of this component is Built-in and cannot be updated. |

## Advanced Settings

| Properties | Description |
| --- | --- |
| Wait for file to be released Every (in<br>ms) | Select this check box so that the next component is triggered only<br>after the file operation is completed. |

## Global Variables

| Variables | Description |
| --- | --- |
| Global Variables | ERROR\_MESSAGE: the error message generated by the<br>component when an error occurs. This is an After variable and it returns a string. This<br>variable functions only if the Die on error checkbox is<br>cleared, if the component has this checkbox.<br><br><br>CURRENT\_ITERATION: the sequence number of<br>the current iteration. This is a Flow variable and it returns an integer.<br><br><br>PRESENT\_FILE: the path and name of the present file. This is a Flow<br>variable and it returns a string.<br><br><br>DELETED\_FILE: the path and name of the<br>deleted file. This is a Flow variable and it returns a string.<br><br><br>CREATED\_FILE: the<br>path and name of the created file. This is a Flow variable and it returns a<br>string.<br><br><br>UPDATED\_FILE: the path and name of the updated file. This is a Flow<br>variable and it returns a string.<br><br><br>FILENAME: the name<br>of the file being processed. This is a Flow variable and it returns a string.<br><br><br>NOT\_UPDATED\_FILE: the path and name of the<br>file that has not been updated. This is a Flow variable and it returns a string.<br><br>A Flow variable functions during the execution of a component<br>while an After variable functions after the execution of the component.<br><br>To fill up a field or expression with a variable, press Ctrl+Space to access the variable list and choose the variable to use from<br>it.<br><br>For more information about variables, see [Using contexts and variables](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/contexts-and-variables). |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | This component plays the role of triggering the next component<br>based on the defined condition. Therefore this component requires<br>another component to be connected to it via a link. |
| Connections | Outgoing links (from this component to another):<br><br><br>Row: Main; Iterate.<br><br><br>Trigger: On Subjob Ok; Run if; On<br>Component Ok; On Component Error.<br><br>Incoming links (from one component to this one):<br><br><br>Row: Iterate.<br><br><br>Trigger: On Subjob Ok; Run if; On<br>Component Ok; On Component Error; Synchronize; Parallelize.<br><br>For further information regarding connections, see [Using connections in a Job](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/using-connections-in-job). |

**Related concepts**

* [Waiting for a file to be created and continuing the iteration loop after a message is triggered](https://help.qlik.com/talend/en-US/components/8.0/orchestration/twaitforfile-waiting-for-file-to-be-created-and-continuing-iteration-loop-after-message-is-triggered-standard-component "Based on Waiting for a file to be created and stopping the iteration loop after a message is triggered, this scenario describes a Job that triggers a message on the console when a text file is created in the directory being scanned, without ending the scanning process immediately. The Job continues scanning the directory until the number of iterations reaches the defined maximum value.")
* [Waiting for a file to be created and stopping the iteration loop after a message is triggered](https://help.qlik.com/talend/en-US/components/8.0/orchestration/twaitforfile-tjava-waiting-for-file-to-be-created-and-stopping-iteration-loop-after-message-is-triggered-standard-component-this)