> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Filesystem: Move a file

> Moves a file to another directory or filesystem.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Moves a file from one location to another. Unlike copying, the original file is removed once the move succeeds. Use this to tidy up after processing, for example moving an imported order file out of an `inbox` folder into a `processed` folder, or relocating a file to a different filesystem connection such as an FTP server or an S3 bucket. The data passing through is left unchanged, so this step is purely an action on files.

This documentation describes: [Schema](/schemas/transformer/filesystem-move-file)

## Fields

<FormField property="sourceFilesystem" label="Source filesystem connection" required diType="filesystem">
  The filesystem connection that currently holds the file you want to move.
</FormField>

<FormField property="path" label="Path of the file" required>
  The location of the file to move on the source connection, including the file name and extension, for example `inbox/order-1042.csv`. You can use [placeholders](/references/placeholders) here to build the path from the data, such as `inbox/&{order.id}.csv`.
</FormField>

<FormField property="destinationFilesystem" label="Destination filesystem connection" diType="filesystem">
  The filesystem connection the file should be moved to. Leave it empty to move within the source connection.
</FormField>

<FormField property="destinationDirectory" label="Destination directory">
  The folder the file should be moved into. Leave it empty to move it to the root of the destination connection. You can use [placeholders](/references/placeholders) here to route files into folders based on the data.
</FormField>

<FormField property="destinationFilename" label="Destination filename">
  The name to give the file at its new location, including its extension. Leave it empty to keep the original file name. You can use [placeholders](/references/placeholders) here too.
</FormField>

<FormField property="onExists" label="When the destination exists">
  What to do when a file with the same name already exists at the destination. Choose Skip to leave the existing file untouched and do nothing, so the source file stays where it is (the default), Overwrite to replace it, or Rename to keep both by giving the moved file a new name. When you choose Rename, a Rename strategy field appears so you can pick how the new name is generated.
</FormField>

<FormField property="ensureDestination" label="Rename strategy" diType="filesystem-ensure-destination">
  Only shown when "When the destination exists" is set to Rename. The way a new file name is generated so the moved file does not overwrite the existing file, for example by adding an increasing number to the name.
</FormField>

## Sample data

This step moves a file rather than transforming the data, so there is no before/after to show. The configuration below moves an imported order file into a `processed` folder on the same connection, giving it a new name if a file with that name is already there.

| Field                        | Value                                    |
| ---------------------------- | ---------------------------------------- |
| Source filesystem connection | The connection holding the imported file |
| Path of the file             | `inbox/order-1042.csv`                   |
| Destination directory        | `processed`                              |
| When the destination exists  | Rename                                   |
| Rename strategy              | Add an increasing number to the filename |

```json Configuration theme={null}
{
  "prototype": "filesystem-move-file",
  "parameters": {
    "sourceFilesystem": "import-files",
    "path": "inbox/order-1042.csv",
    "destinationDirectory": "processed",
    "onExists": "rename",
    "ensureDestination": {
      "prototype": "increase-counter",
      "parameters": {
        "template": "{dirname}/{filename}-{counter}.{extension}"
      }
    }
  }
}
```
