# Rename the file

> Names the file from the details found, for example the supplier and the date. The file keeps its own extension.

Source: https://docs.go-lumen.ai/reference/steps/rename-file

## At a glance

| Property | Value |
| --- | --- |
| **Step name** | `rename-file` |
| **Resource** | ClusterStep (`lumen.ai/v1alpha1`) |
| **Palette group, category** | files, files |
| **Credits** | **1** credit each time it succeeds |
| **Side effects** | no |
| **Installation must provide** | nothing |

## Inputs

| Property | Value |
| --- | --- |
| **Needs** | `file` |
| **Produces** | `file` |
| **Works on** | item: one document at a time |

Needs and Produces are data types (file, text, fields, email). The editor offers a step only where what it needs is already on the path. See [Documents and data](https://docs.go-lumen.ai/concepts/how-flows-run.md#documents-and-data).

## Outputs

No named outputs. Later nodes still see everything produced earlier on the path, and this step passes the documents on unchanged.

## Settings

Set under `config:` on the flow node. Text settings may contain `{nodeId.field}` placeholders.

| Setting | Type | Default | Description |
| --- | --- | --- | --- |
| `pattern` | string |  | Pattern names the file from fields: "`{supplier}` `{date}`", or "`{find-invoice-details.reply}`" for a step's answer. The original file's extension is always kept: added when the name has none, never doubled. (minLength 1) |

The full JSON Schema of these settings: [rename-file.schema.json](https://docs.go-lumen.ai/schemas/steps/rename-file.schema.json).

## Example

Name an invoice after its supplier and date

```yaml title="config"
pattern: '{supplier} {date}'
```

## Use it in a flow

A node that runs `rename-file` goes under `spec.nodes` of a [Flow](https://docs.go-lumen.ai/concepts/how-flows-run.md#the-flow-as-yaml). Give it any id, and list the next node ids in next.

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: rename-file-example
  namespace: tenant-acme
spec:
  displayName: "Rename the file"
  triggers:
    - id: start
      ref: {name: manual-run}
      next: [rename-file]
  nodes:
    - id: rename-file
      stepRef: {name: rename-file}
      config:
        pattern: '{supplier} {date}'
```
