# create-directory

Learn how to create a directory.

This action creates a directory, including any missing parents.

> **Idempotent**
>
> If the directory already exists, the action completes without error, making it safe to run multiple times.

This is helpful for setting up project structure before writing files, such as creating `src/components` or `src/lib` directories during scaffolding.

## Example

The following template creates a components directory and prints a confirmation:

**template.json5**

```json5
{
  "$schema": "https://schema.croct.com/json/v1/template.json",
  "title": "Directory setup",
  "description": "Creates a components directory.",
  "actions": [
    {
      "name": "create-directory",
      "path": "src/components"
    },
    {
      "name": "print",
      "semantics": "info",
      "message": "Directory src/components is ready."
    }
  ]
}
```

To apply this template, run:

```sh
croct use template.json5
```

## Properties

These are the supported properties:

- `name`: `string`

  The action identifier. Always `create-directory` for this action.

- `path`: `string`

  The path to the directory to create.

## Explore

- [Write file](/reference/cli/templates/actions/write-file): Learn how to write files into the directory.
- [Delete path](/reference/cli/templates/actions/delete-path): Learn how to delete a directory or file.
- [Move path](/reference/cli/templates/actions/move-path): Learn how to move or rename a directory.
- [Locate path](/reference/cli/templates/actions/locate-path): Learn how to find an existing directory.
