# mkdir()

Canonical URL: https://developers.iagenify.com/sdk/ref/local-files/mkdir/
Language: en

`files.mkdir(dir) → Promise<Item>`

Creates a folder, and every parent it needs. Succeeds on a folder that is already there.

Status: free · creates parents · idempotent

## Parameters {#parameters}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `dir` | string | required | The folder to create, relative to the workspace. The workspace root is refused. |

```javascript
await pc.files.mkdir("Clients/Acme/2026");
// { name: "2026", path: "Clients/Acme/2026", type: "folder", size: null, mimeType: null, modifiedAt: "…" }

// Calling it again changes nothing and still answers
await pc.files.mkdir("Clients/Acme/2026");
```

## Parents are created too {#parents}

`Clients` and `Clients/Acme` are created if they are not there. So a tree is one call, not one call per level — and an existing folder along the way is left exactly as it is.

## You rarely need it {#write}

> **write() already creates the folders of its path**
>
> mkdir() is for an empty folder you want to exist on its own — a destination prepared in advance, a structure shown in an interface. For writing a file, go straight to write().

## Errors {#errors}

| Code | Status | When |
| --- | --- | --- |
| invalid_path | 400 | Absolute, outside the workspace, or the workspace root. |
| local_files_require_node | 400 | The runtime has no filesystem. |
| storage_not_on_this_machine | 409 | Another computer's storage. |

A path that names an existing **file** is a filesystem error, not one of ours: the operating system refuses to make a folder where a file sits, and the message comes through.

- [write()](/sdk/ref/local-files/write): Write a file; its folders are made for you.
- [LocalFiles](/sdk/ref/local-files): The workspace, the path rules, and the shape every method returns.

```python
pc.files.mkdir("Clients/Acme/2026")
# {"path": "Clients/Acme/2026"}

# Calling it again changes nothing and still answers
pc.files.mkdir("Clients/Acme/2026")
```
