# Exclude task

An Exclude takes items off the job's list. The files themselves are not touched: the job only stops looking at them.

It is the one task whose filter works the other way round. Everywhere else, the filter says what a task acts on and the rest passes through. Here, what the filter matches is what goes.

> If an item matches the filter, it will be excluded from the future task processing.

## Fields

| Field | What it does |
|---|---|
| **Filter** (the task's own filter, at the top) | the items that are taken off the list. A pattern with `*` and `?`, compared with each item's whole address. |
| **Limit items list count to** | of the items the filter does not match, the first so many are kept and the rest are dropped too. Empty: no limit. |

A new task has the filter `*`, which matches everything: an Exclude that is left as it is empties the list.

## What it hands on

The items that did not match, in their order, up to the limit.

## Uses

| To | Filter |
|---|---|
| drop the temporary files | `*.tmp` |
| drop everything in a folder | `*/drafts/*` |
| empty the list, before a second Find starts afresh | `*` |
| keep only the PDFs | cannot be said with one pattern: use a [Jump](Task-Jump.md) with `{ext}` **Equals** `.pdf`, or let the Find look for `*.pdf` only |
| work on 500 files per run | a filter that matches nothing, such as `-`, and **Limit items list count to** `500` |

With a limit, sort first: a [Sort](Task-Sort.md) by date before the Exclude makes "the first 500" the oldest 500.

## Things to know

- **Filter in the Find where you can.** A Find for `*.csv` is cheaper than a Find for `*` and an Exclude: the items never get on the list. Exclude is for lists that come from elsewhere, an event or an earlier task, and for dropping items in the middle of a job.
- **After a Zip.** A [Zip](Task-Zip.md) leaves the single files on the list with the zip behind them. An Exclude for everything that is not the zip is the classic next step; the Zip's own **Delete Original?** or a filter on the next task does the same with less.
- **Excluded is not deleted.** To remove files, use [Delete](Task-Delete.md).
- **Branches.** An Exclude in one [branch](Jobs-Flow.md#branches) does not touch the lists of the others.
