# create\_folder()

## Create new folder

&#x20; <mark style="background-color:orange;">create\_folder()</mark> &#x20;

This method will create a new folder in the cloud.

{% tabs %}
{% tab title="OneDrive" %}

### **Parameters**

| Name         | Type   | Description                                              |
| ------------ | ------ | -------------------------------------------------------- |
| `$new_name`  | string | The name of the folder to be created.                    |
| `$parent_id` | string | ID of the folder where the new folder should be created. |

### **Return**

| Name    | Type           | Description                                   |
| ------- | -------------- | --------------------------------------------- |
| `$node` | **CachedNode** | The cached object for the new created folder. |

### **Usage**

```php
WPCP_ONEDRIVE_API::set_account_by_id('8c9bacda0-d8d8-4b22-b634-7b5281687575');
WPCP_ONEDRIVE_API::set_drive_by_id('b!DlaHWskCed_MIid3KpJH5Lbatf9HsdXBAZH5YcvPAbMhJUKzTJyzgvXZYpBS');

// Create a new folder
$node = WPCP_ONEDRIVE_API::create_folder('Documents', '01EXLSWHRCD7RDL3HX65BK5X3ULXLWSICN');
```

{% endtab %}

{% tab title="Google Drive" %}

### **Parameters**

<table><thead><tr><th>Name</th><th width="88">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$new_name</code></td><td>string</td><td>The name of the folder to be created.</td></tr><tr><td><code>$parent_id</code></td><td>string</td><td>ID of the folder where the new folder should be created.</td></tr></tbody></table>

### **Return**

| Name    | Type           | Description                                   |
| ------- | -------------- | --------------------------------------------- |
| `$node` | **CachedNode** | The cached object for the new created folder. |

### **Usage**

```php
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')

$node = WPCP_GDRIVE_API::get_folder('1FCYkOJb150I8nl8DE92YIXWaB0J7VOk5');

$node->get_name();

foreach ($node->get_children() as $id => $entry_node) {
  $entry_node->get_name();
}
```

{% endtab %}

{% tab title="Dropbox" %}

### **Parameters**

<table><thead><tr><th width="272">Name</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$new_name</code></td><td>string</td><td>The name of the folder to be created.</td></tr><tr><td><code>$target_folder_path</code></td><td>string</td><td>The folder path where the new folder should be created</td></tr><tr><td><code>($params)</code></td><td>array </td><td>Additional Parameters. Use <code>['autorename' => true]</code> to automatically rename the folder if a folder with the same name already exists.</td></tr></tbody></table>

### **Return**

<table><thead><tr><th width="272">Name</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$entry</code></td><td><strong>Entry</strong></td><td>The object for the new folder.</td></tr></tbody></table>

### **Usage**

```php
WPCP_DROPBOX_API::set_account_by_id('dbid:AADSy6JxzbgqCs4A43CAAAfO9xvZwpcsLU');

// Create a new folder
$entry = WPCP_DROPBOX_API::create_folder('Documents', '/Path/to/Client/Folder');
```

{% endtab %}

{% tab title="Box" %}

### **Parameters**

| Name         | Type   | Description                                              |
| ------------ | ------ | -------------------------------------------------------- |
| `$new_name`  | string | The name of the folder to be created.                    |
| `$parent_id` | string | ID of the folder where the new folder should be created. |

### **Return**

| Name    | Type           | Description                                   |
| ------- | -------------- | --------------------------------------------- |
| `$node` | **CachedNode** | The cached object for the new created folder. |

### **Usage**

```php
WPCP_BOX_API::set_account_by_id('29232154182');

// Create a new folder
$node = WPCP_BOX_API::create_folder('Documents', '511426724354');
```

{% endtab %}
{% endtabs %}
