# rename (FTP command)

### Overview

The `rename` command changes the name of specified files. You can [rename single/multiple files and leave them in the same directory](#renaming-but-not-moving-a-file), or you can [rename files into a different directory](#renaming-and-moving-a-file).

## Need to know

* No content is loaded into the flow. A boolean value is returned to indicate a successful/failed file operation.
* Regular expressions are supported in filenames.

## Connection settings

When [configuring an SFTP connector](/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape/configuring-sftp-connections.md), three fields should be updated:

| FTP command                                                                             | Root                                              | Path                                            |
| --------------------------------------------------------------------------------------- | ------------------------------------------------- | ----------------------------------------------- |
| FTP command followed by the required directory and name for the file when it's renamed. | The common root to source and target directories. | The source directory and file(s) to be renamed. |

## Examples

* [Rename but don't move a file](#renaming-but-not-moving-a-file)
* [Rename & move a file](#renaming-and-moving-a-file)

### Renaming but not moving a file&#x20;

* [Scenario](#scenario)
* [The steps](#the-steps)

#### Scenario

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><p>Our process flow is configured as below:</p><div><figure><img src="/files/qN2g17MJQH0LUfftEfNY" alt=""><figcaption></figcaption></figure></div></td><td><a href="/files/rI8jPerjv9MFfSCvdBbq">/files/rI8jPerjv9MFfSCvdBbq</a></td></tr><tr><td><p>In this flow, we need to rename a file named <code>hello.txt</code> in <code>/myfiles/folderC</code> to <code>goodbye.txt</code>:<br><br><img src="/files/IIBtoFNllW0AUVX1qeAD" alt=""></p><p></p><p>We want the renamed file to end up in the same directory.</p></td><td><a href="/files/2vpVY6Q37YrYqTgeZirK">/files/2vpVY6Q37YrYqTgeZirK</a></td></tr></tbody></table>

#### The steps

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><p><strong>Connector settings</strong></p><p>Our SFTP shape is configured as follows: </p><div align="left"><figure><img src="/files/fTgYYKDZNLjW5rgY5SmL" alt=""><figcaption></figcaption></figure></div><ul><li>Use the <code>SFTP GET user pass</code> endpoint.</li><li>Start looking for the file to rename from the <code>root</code>, which is defined as: <code>/myfiles/</code></li><li>Check the <code>path</code> for the file to rename, which is defined as: <code>folderC/hello.txt</code></li><li>Rename the file to the directory/name provided immediately after the <code>ftp command</code>. This is defined as: <code>rename:folderC/goodbye.txt</code>   </li></ul></td><td><a href="/files/oMb9sRQ3X0NcUlY4i8Mk">/files/oMb9sRQ3X0NcUlY4i8Mk</a></td></tr><tr><td><p><strong>Payload &#x26; SFTP server</strong> </p><p>When the process flow is run, the payload for our SFTP shape shows just a <code>1</code>: </p><div align="left"><figure><img src="/files/phvQnMVVkyh1BdgGl47J" alt=""><figcaption></figcaption></figure></div><p>A <code>1</code> indicates a successful response from your remote server. A <code>0</code> indicates an unsuccessful response. </p><p></p><p>On our remote server, <code>hello.txt</code> is now named <code>goodbye.txt</code> (still in <code>/folderC</code>):<br><br><img src="/files/YBmweuzfszl8MnYz33pS" alt=""></p><p></p></td><td><a href="/files/J6YFhcQQMgUmK2sBQwdu">/files/J6YFhcQQMgUmK2sBQwdu</a></td></tr></tbody></table>

### Renaming & moving a file

* [Scenario](#scenario)
* [The steps](#the-steps)

#### Scenario

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><p>Our process flow is configured as follows:</p><div><figure><img src="/files/9G04IVsf8aCykiOFRtox" alt=""><figcaption></figcaption></figure></div></td><td><a href="/files/rI8jPerjv9MFfSCvdBbq">/files/rI8jPerjv9MFfSCvdBbq</a></td></tr><tr><td>In this flow, we need to <code>rename</code> <code>/myfiles/folderE/hello.txt</code>:<br><br><img src="/files/7sfUo4GAokzhlSN8xf4h" alt=""><br><br>The file will be renamed as <code>/myfiles/folderF/goodbye.txt</code> - so we are both moving and renaming the file:<br><br><img src="/files/hD2bXezN4xpo6Le0ocHe" alt=""></td><td><a href="/files/2vpVY6Q37YrYqTgeZirK">/files/2vpVY6Q37YrYqTgeZirK</a></td></tr></tbody></table>

#### The steps

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><p><strong>Connector settings for SFTP shape</strong></p><p>Our first <code>SFTP connector</code> step is configured as follows: </p><div align="left"><figure><img src="/files/Y1gQLEbVI0Fl9TgWTx0w" alt=""><figcaption></figcaption></figure></div><ul><li>Use the <code>SFTP GET user pass</code> endpoint.</li><li>Start looking for the file to rename from the <code>root</code>, which is defined as: <code>/myfiles/</code></li><li>Check the <code>path</code> for the file to rename, which is defined as: <code>folderE/hello.txt</code></li><li>Rename the file to the directory/name provided immediately after the <code>ftp command</code>. This is defined as: <code>rename:folderF/goodbye.txt</code></li></ul></td><td><a href="/files/oMb9sRQ3X0NcUlY4i8Mk">/files/oMb9sRQ3X0NcUlY4i8Mk</a></td></tr><tr><td><p><strong>Payload</strong> <strong>for SFTP shape</strong><br>When the process flow is run, the payload for our SFTP shape shows just a <code>1</code>: </p><div align="left"><figure><img src="/files/phvQnMVVkyh1BdgGl47J" alt=""><figcaption></figcaption></figure></div><p>A <code>1</code> indicates a successful response from your remote server. A <code>0</code> indicates an unsuccessful response. </p><p><br><br></p></td><td><a href="/files/vHd6zemYZQgFjIQ5t6sj">/files/vHd6zemYZQgFjIQ5t6sj</a></td></tr><tr><td><p><strong>Remote server outcome</strong>  </p><p>On our remote server, <code>hello.txt</code> is gone from <code>/myfiles/folderE</code>: <br><br><img src="/files/eqVRWrOjlT6w4pXj3MjX" alt=""></p><p><br>But now we have a file named, <code>goodbye.txt</code> in <code>/myfiles/folderF</code>: </p><p></p><p><img src="/files/LzN5h4VRItVMRlTDRwHY" alt=""><br></p></td><td><a href="/files/CaDlvrcB9Vd1DmUVmK9d">/files/CaDlvrcB9Vd1DmUVmK9d</a></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape/configuring-sftp-connections/valid-ftp-commands/rename-ftp-command.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
