> For the complete documentation index, see [llms.txt](https://docs.couchdrop.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.couchdrop.io/automations/variables.md).

# Variables

Learn about variable use in Transfer Automations

## Overview

Variables let you dynamically build filenames and folder paths in Couchdrop Automations.

Instead of entering a fixed filename or destination path, you can use variables that are replaced with values from the file, the user, the workflow event, or the current timestamp when the Automation runs.

For example, you can use variables to:

* Keep the original filename when moving or copying a file
* Create folders based on the current year, month, or day
* Include the uploading user in a destination path
* Reference information from the event that triggered the Automation
* Extract values from filenames or file contents and reuse them in later actions

Variables can be added anywhere an Automation action supports a filename or path.

{% hint style="info" %}
You can also create Custom Variables using the Extract Variable from Filename action. For more details, see [Supported Actions](/automations/actions.md#available-actions).
{% endhint %}

## Default variables

The following variables are available for automations

<table><thead><tr><th width="262.88671875">Key</th><th width="187.765625">Value Example</th><th>Description</th></tr></thead><tbody><tr><td>{USER}</td><td>michael.lawson</td><td>The user who was uploading the file</td></tr><tr><td>{EXISTING_NAME}</td><td>test.txt</td><td>The current filename including the extension</td></tr><tr><td>{EXISTING_NAME_NOEXT}</td><td>test</td><td>The current filename without the extension</td></tr><tr><td>{EXISTING_NAME_EXT}</td><td>.txt</td><td>The extension only of the current filename</td></tr><tr><td>{YYYY}</td><td>2023</td><td>The current timestamp year</td></tr><tr><td>{YY}</td><td>23</td><td>The current timestamp year in shortform</td></tr><tr><td>{MMM}</td><td>AUG</td><td>The month in a human readable format</td></tr><tr><td>{MM}</td><td>03</td><td>The month in a numerical format</td></tr><tr><td>{DD}</td><td>02</td><td>The day of the month</td></tr><tr><td>{TIME_HH}</td><td>23</td><td>Hour in 24 hour time</td></tr><tr><td>{TIME_MM}</td><td>30</td><td>Minutes of the hour</td></tr><tr><td>{TIME_SS}</td><td>24</td><td>Seconds on the minute</td></tr><tr><td>{TIMESTAMP}</td><td>1711330141</td><td>Unix timestamp. Number of seconds since Jan 1st 1970.</td></tr><tr><td>{TIMESTAMP_MS}</td><td>1659992501</td><td>Timestamp with milliseconds when the workflow was triggered</td></tr><tr><td>{EVENT.EVENT_TYPE}</td><td>download</td><td>Event type that executed the workflow</td></tr><tr><td>{EVENT.SYSTEM}</td><td>webportal</td><td>Specifies the channel where the workflow was originated</td></tr><tr><td>{EVENT.STORAGE_ENGINE}</td><td>googledrive</td><td>Storage type name where the workflow was originated</td></tr><tr><td>{EVENT.STORAGE_ENGINE_ID}</td><td>4c0a140-9177-4581-98d3-4ea7215364aa</td><td>Unique identifier of the configured storage where the workflow was originated</td></tr><tr><td>{EVENT.TIMESTAMP}</td><td>1659442224.463902</td><td>Raw timestamp value of the event triggered in the workflow</td></tr><tr><td>{EVENT.EVENT_ID}</td><td>bef26414-b7c1-41de-986e-98de45abcd</td><td><p></p><p>Unique identifier of the event triggered every time a workflow is executed. All actions configured int he same workflow will share the same event ID. </p></td></tr><tr><td>{EVENT.additional_info.required_fields.&#x3C;FIELD_NAME>}</td><td></td><td>Substitute &#x3C;field_name> with the name of the Web Inbox required field to access data provided on upload. </td></tr></tbody></table>

{% hint style="info" %}

### Example

A destination path such as:

`/archive/{YYYY}/{MM}/{EXISTING_NAME}`

could resolve to:

`/archive/2026/08/test.txt`

This lets the Automation organize files dynamically without requiring a separate workflow for each date or filename.
{% endhint %}

## Custom variables

Custom variables let you extract information from a filename or from the contents of a file and use the extracted value in later Automation actions.

Couchdrop provides two actions for creating custom variables:

* **Extract Variable from Filename**
* **Extract Variable from File**

The extraction action must run before any action that uses the custom variable.

{% hint style="warning" %}
If the regular expression does not return a match, actions after the extraction action will not be executed. Place variable extraction actions as early as possible in the workflow.
{% endhint %}

### Extract Variable from Filename

**Extract Variable from Filename** uses a regular expression to extract a value from the filename and make that value available to later actions.

When creating the action, configure:

| Setting             | Description                                                                                                 |
| ------------------- | ----------------------------------------------------------------------------------------------------------- |
| **Variable name**   | Enter a unique name for the variable.                                                                       |
| **Regex pattern**   | Enter the regular expression Couchdrop will use to extract the value from the filename.                     |
| **Description**     | Optionally describe what the variable represents.                                                           |
| **Test your regex** | Enter an example filename to check what value the regular expression will extract. The first match is used. |

After the variable has been created, use **Add Automation Variable** in a supported later action to insert it.

{% hint style="info" %}

#### Example

If incoming files use a naming convention such as:

`customer-4821-invoice.pdf`

you could use **Extract Variable from Filename** with a regular expression that matches `4821`, save it as a custom variable, and then reference that value in later actions.
{% endhint %}

### Extract Variable from File

**Extract Variable from File** works in the same way but applies the regular expression to the contents of the file rather than its filename.

When creating the action, configure:

| Setting             | Description                                                                                          |
| ------------------- | ---------------------------------------------------------------------------------------------------- |
| **Variable name**   | Enter a unique name for the variable.                                                                |
| **Regex pattern**   | Enter the regular expression Couchdrop will use to extract the value from the file.                  |
| **Description**     | Optionally describe what the variable represents.                                                    |
| **Test your regex** | Enter example text to check what value the regular expression will extract. The first match is used. |

The extracted value can then be added to supported actions later in the workflow using **Add Automation Variable**.

### Using custom variables after extraction

Custom variables are only available after their extraction action has successfully run.

For example, a workflow could:

1. Use **Extract Variable from Filename** to identify a value in an incoming filename.
2. Store the result as an Automation variable.
3. Use that variable in the destination path or filename of a later action.

This allows one Automation to dynamically route or rename files based on information contained in the filename or file itself.
