Get or Create Folder
Audience:
Business UsersSkill Prerequisites:
Tokens
Returns a folder from the site's file system, creating it first if it doesn't exist. Any missing parent folders in the path are created too, so Clients/Acme/2026/Invoices can be created in one step.
The folder's name, ID and path are saved as tokens for use by the actions that follow, such as Copy File, Save File or Alter Folder Permissions.
Typical Use Cases
- Make sure a destination folder exists before saving or copying files into it
- Build folder structures from submitted data, for example one folder for each customer or each year
- Create a folder in Amazon S3 or another storage connection instead of the default folder type
- Get the folder ID of a known folder path for actions that need an ID
Don't use it to
- Rename or move an existing folder. Use Rename Folder or Move Folder instead.
- Change the storage type of an existing folder. If the folder already exists,
Storage Connectionis ignored.
Related Actions
| Action Name | Description |
|---|---|
| Alter Folder Permissions | Sets permissions on the folder after it's created. |
| Manage S3 Service Connection | Creates an Amazon S3 storage connection whose ID can be used in Storage Connection. |
| Delete Folder | Deletes a folder. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Folder Path | The path of the folder to get or create, relative to the portal root (for example Clients/[CustomerName]). Backslashes are converted to forward slashes. A trailing slash is optional. | Yes | none selected | Yes |
| Storage Connection | The folder type (storage connection) to use only if the folder has to be created, for example an Amazon S3 connection. Select one from the list, or in expression mode enter the connection's numeric ID. Leave empty to use the site's default folder type. | Yes | Default folder type | No |
Output Parameters Reference
| Parameter | Description |
|---|---|
| Output Token Name | The name of the token that stores the folder details. See the tokens in the next table. |
If Output Token Name is MyFolder, the following tokens are created:
| Token | Description | Example |
|---|---|---|
[MyFolder] | The folder path, relative to the portal root, with a trailing slash. | Clients/Acme/ |
[MyFolder:FolderPath] | Same as [MyFolder]. | Clients/Acme/ |
[MyFolder:FolderName] | The name of the folder only. | Acme |
[MyFolder:FolderId] | The folder ID. | 157 |
Considerations
- The action fails if
Storage Connectionpoints to a connection ID that doesn't exist. - New folders are created with the default permissions for their location. Use Alter Folder Permissions to restrict access.
- Characters that aren't valid in folder names, such as
:or*, cause the action to fail. Clean up user-entered values before using them in a path.
Examples
To understand how to use the below examples, please see Running Examples.
1. Create a folder for each customer and year
This action creates Clients/<Company>/<Year>/ from a Company form field and the current year, and saves the details in the ClientFolder token.
{
"Title": "Get or Create Folder",
"ActionType": "GetOrCreateFolder",
"Description": "Create the customer's folder for this year",
"Condition": null,
"Parameters": {
"FolderPath": {
"Expression": "Clients/[Company]/[DateTime:Now|yyyy]",
"Value": "",
"IsExpression": true,
"Parameters": {}
},
"FolderMappingConnection": {
"Expression": "",
"Value": "",
"IsExpression": false,
"Parameters": {}
},
"OutputTokenName": "ClientFolder"
}
}
After this action runs, [ClientFolder:FolderId] can be passed to other actions, and [ClientFolder] can be used as a folder path.
2. Create a folder on an Amazon S3 storage connection
This action creates Archive/Reports/ using the storage connection with ID 5. If the folder already exists, it's returned unchanged.
{
"Title": "Get or Create Folder",
"ActionType": "GetOrCreateFolder",
"Description": "Create an S3-backed folder",
"Condition": null,
"Parameters": {
"FolderPath": {
"Expression": "Archive/Reports",
"Value": "",
"IsExpression": true,
"Parameters": {}
},
"FolderMappingConnection": {
"Expression": "5",
"Value": "",
"IsExpression": true,
"Parameters": {}
},
"OutputTokenName": "ReportsFolder"
}
}
Revised 09/25/2026