# Conditions on a task

A task does not have to act on everything it is given. This page is about the three kinds of condition in a job: the filter every task has, the comparisons of the flow tasks, and the way a task's form changes with the address you give it.

## The filter of a task

Every task has a filter at the top of its **Config** tab:

| Field | On | What it does |
|---|---|---|
| **Folder Traversal Filter** | most tasks | the task acts on the items whose address matches |
| **Source Filter** | Find | the same, for the items a Find was given |
| **Process first item only** | most tasks | the task acts on the first item that matches and leaves the rest |

The filter is a pattern with `*` for any text and `?` for one character. It is compared with the item's whole **address**, not only its name:

| Filter | Matches |
|---|---|
| `*` | everything. This is what a new task has. |
| `*.csv` | every address that ends in `.csv` |
| `*/Invoices/*` | everything in a folder named Invoices |
| `*{user_name}*` | addresses with the name of the user of the event in them: a filter may hold [variables](Jobs-Variables.md) |

Items that do not match are **not dropped**. The task leaves them alone and passes them on with the others. So a job can have a PGP task with the filter `*.pgp` and a Copy with `*` behind it: the PGP task decrypts the encrypted files, and the Copy copies all of them.

To drop items, use [Exclude](Task-Exclude.md). To send some items one way and the rest another, use [Jump](Task-Jump.md). To give each of several paths its own kind of file, use the filters of a [Branch](Task-Branch.md)'s dots.

## Comparisons

[Jump](Task-Jump.md), [Wait](Task-Wait.md) and [Loop](Task-Loop.md) compare two values. Each value is text and may hold variables: `{size}`, `{name}`, `{items_count}`, a variable of your own.

| Comparison | True when | Notes |
|---|---|---|
| **Equals**, **Doesn't Equal** | the two texts are the same, or not | upper and lower case count |
| **Contains**, **Doesn't Contain** | the second text is in the first | upper and lower case count |
| **Matches Pattern**, **Doesn't Match Pattern** | the first value matches the second as a pattern with `*` and `?` | Jump and Loop tell upper from lower case; Wait does not |
| **Greater Than**, **Less Than**, **Greater Than Or Equal**, **Less Than Or Equal** | by number | both values must be numbers. The two "Or Equal" comparisons are in Jump and Loop. |
| **Greater than datetime**, **Less than datetime** | by date | Wait only. `MM/dd/yyyy HH:mm:ss`, `MM/dd/yyyy` or `HH:mm:ss`. |

- **Both fields empty** is always true.
- **A number comparison on text** is neither true nor false. In a Jump, such an item goes neither way.
- **Numbers written as text** compare as text with Equals: `10` does not equal `10.0`.

Examples:

| First | Comparison | Second | True for |
|---|---|---|---|
| `{size}` | Greater Than | `1048576` | files over 1 MB |
| `{name}` | Matches Pattern | `INV_*.pdf` | invoices |
| `{items_count}` | Equals | `0` | an empty list |
| `{ext}` | Equals | `.zip` | zip files |
| `{task_error}` | Contains | `timed out` | a time-out in an earlier task |

Comparisons need an Enterprise licence. Without one, a Jump writes "Conditionals only apply for Enterprise licenses." to the log and treats no item as matching.

## A form that changes with the address

Tasks that reach a place, such as Find, Copy, Delete and Unzip, have an address field. What the rest of the form shows depends on how the address begins:

| Address begins with | The form also shows |
|---|---|
| `file://` | nothing more |
| `ftp://`, `ftps://`, `ftpes://` | passive mode, the settings for the data channel, and for the encrypted kinds the settings for the certificate |
| `sftp://` | the private key and its password, key checking, ciphers |
| `http://`, `https://`, `webdav://`, `webdavs://` | the settings for web addresses, and for the encrypted kinds the certificate |
| `smb://`, `smb3://` | domain, signing, DFS |
| `s3://`, `s3crush://`, `gstorage://`, `azure://`, `glacier://` | the keys and the settings of that storage |
| `onedrive://`, `sharepoint://`, `gdrive://`, `dropbox://`, `box://` | the sign-in of that service |
| `{` (a variable) | all of them, because the kind is not known until the job runs |

The fields are the ones of the same kind of place in the User Manager: see [VFS](VFS.md) and the page of each kind. A field that is not shown is not used.

Everywhere but for `file://` and `memory://` there is also **Use DMZ**: the connection is made from a DMZ server in place of this one. See [VFS: advanced settings](VFS-Advanced.md).

Other forms change by their own switches: the [Wait](Task-Wait.md) shows the settings for joining when **Join the branches** is ticked, the [Loop](Task-Loop.md) shows the fields of its mode, the [HTTP](Task-HTTP.md) task those of the chosen kind of sign-in, and the [Email](Task-Email.md) task those of Google or Microsoft when the mail server is one of theirs.
