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, or you can rename files into a different directory.
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, three fields should be updated:
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
Renaming but not moving a file
Scenario

Our process flow is configured as below:


In this flow, we need to rename a file named hello.txt in /myfiles/folderC to goodbye.txt:

We want the renamed file to end up in the same directory.
The steps

Connector settings
Our SFTP shape is configured as follows:

Use the
SFTP GET user passendpoint.Start looking for the file to rename from the
root, which is defined as:/myfiles/Check the
pathfor the file to rename, which is defined as:folderC/hello.txtRename the file to the directory/name provided immediately after the
ftp command. This is defined as:rename:folderC/goodbye.txt

Payload & SFTP server
When the process flow is run, the payload for our SFTP shape shows just a 1:

A 1 indicates a successful response from your remote server. A 0 indicates an unsuccessful response.
On our remote server, hello.txt is now named goodbye.txt (still in /folderC):

Renaming & moving a file
Scenario

Our process flow is configured as follows:


In this flow, we need to rename /myfiles/folderE/hello.txt:
The file will be renamed as /myfiles/folderF/goodbye.txt - so we are both moving and renaming the file:

The steps

Connector settings for SFTP shape
Our first SFTP connector step is configured as follows:

Use the
SFTP GET user passendpoint.Start looking for the file to rename from the
root, which is defined as:/myfiles/Check the
pathfor the file to rename, which is defined as:folderE/hello.txtRename the file to the directory/name provided immediately after the
ftp command. This is defined as:rename:folderF/goodbye.txt

Payload for SFTP shape
When the process flow is run, the payload for our SFTP shape shows just a 1:

A 1 indicates a successful response from your remote server. A 0 indicates an unsuccessful response.

Remote server outcome
On our remote server, hello.txt is gone from /myfiles/folderE:

But now we have a file named, goodbye.txt in /myfiles/folderF:
Last updated
Was this helpful?