# MakeDirectory task

A MakeDirectory makes a folder. Jobs need it more often than one would think, because a [Copy](Task-Copy.md) does not make the folder it copies into.

## Fields

| Field | What it does |
|---|---|
| **Directory Name** | the folder to make, as an address: `file:///data/archive/{yyyy}/{MM}/`. **Browse**, **Test**. |
| **Route connection through DMZ when possible** | the connection is made from a DMZ server |

- Every missing folder on the way is made too: for `…/2026/11/` both `2026` and `11`.
- A folder that is there already is not an error.
- The address can hold [variables](Jobs-Variables.md), of the date or of the item in hand.

## How often it runs

Once for each item its filter matches, and **once when the list is empty**. So:

- at the start of a job, before the Find, it runs once and makes one folder;
- behind a Find, with `{stem}` or `{parent_path}` in the name, it makes a folder per file. The same folder is not made twice in one run.

## What it hands on

The items it was given, unchanged. The folder it made is not put on the list.

## Examples

| To | Directory Name | Then |
|---|---|---|
| file by date | `file:///data/in/{yyyy}/{MM}/{dd}/` | Copy to `file:///data/in/{yyyy}/{MM}/{dd}/{name}` |
| a folder per user, in a job that an event started | `file:///data/users/{user_name}/` | |
| a folder per file | `file:///data/unpacked/{stem}/` | Unzip into it |
| on another server | `sftp://user@host/in/{yyyy}{MM}{dd}/` | |

## Things to know

- **Around midnight.** `{dd}` is worked out when each task runs. A MakeDirectory at 23:59:59 and a Copy at 00:00:01 name two different folders. For jobs that run then, set the date once with a [UserVariable](Task-UserVariable.md) and use that variable in both.
- **Rights.** The folder is made as the account the server runs under, or as the user in the address on another server.
