---
title: "createDirectory"
canonical: "https://support.appfire.com/space/PSCONF/15303128/createDirectory"
format: markdown
---
> Macro (aura-html)

> Macro (table-plus)
> 
> |  |  |  |  |
> | --- | --- | --- | --- |
> | **Syntax** | createDirectory(path_to_directory) | **Package** | file |
> | **Alias** |  | **Pkg Usage** | createDir(path_to_directory) |

## Description

> Macro (excerpt)
> 
> Returns "true" if the directory was created successfully and "false" otherwise.

Returns "true" if the directory was created successfully and "false" otherwise. If returned "false" check the log for a detailed reason on why it failed.

## Parameters

> Macro (table-plus)
> 
> | Parameter name | Type | Required | Description |
> | --- | --- | --- | --- |
> | path_to_directory | String | Yes | Specifies a directory or a path. |

## Return Type

**Boolean (true/false)**

## Example

```
string dir = "C:/myDirectory";
if(directoryExists(dir)){
    print("The directory exists!");
} else {
    if(!createDirectory(dir)){
        print("Failed to create directory " + dir);
    }
}
```

> ⚠️ It is recommended that you use forward slashes ( / ) for file paths.

## See also

> Macro (contentbylabel)