# RenameFile

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.SFTP/tree/main/Frends.SFTP.RenameFile>

{% tabs %}
{% tab title="Parameter: Input" %}

| Name                                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Path : `String`                     | <p>Full path of the target file to be renamed.</p><p><br>Default: <code>-</code><br>Example: <code>/root/folder/example.txt</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| NewFileName : `String`              | <p>New name for the file.</p><p><br>Default: <code>-</code><br>Example: <code>newName.txt</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| RenameBehaviour : `RenameBehaviour` | <p>How the file rename should work if a file with the new name already exists.</p><p>If Rename is selected, will append a number to the new file name e.g. renamed(2).txt</p><p>Possible values:</p><ul><li><code>Throw</code>:</li></ul><p>How the file rename should work if a file with the new name already exists.</p><p>If Rename is selected, will append a number to the new file name e.g. renamed(2).txt</p><ul><li><code>Overwrite</code>:</li></ul><p>How the file rename should work if a file with the new name already exists.</p><p>If Rename is selected, will append a number to the new file name e.g. renamed(2).txt</p><ul><li><code>Rename</code>:</li></ul><p>How the file rename should work if a file with the new name already exists.</p><p>If Rename is selected, will append a number to the new file name e.g. renamed(2).txt</p><p><br>Default: <code>-</code><br>Example: <code>-</code></p> |
| {% endtab %}                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

{% tab title="Parameter: Connection" %}

| Name                                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ConnectionTimeout : `Int32`                      | <p>The lenght of time, in seconds, until the connection times out.</p><p>You can use value -1 to indicate that the connection does not time out.</p><p>Default value is 60 seconds.</p><p><br>Default: <code>60</code><br>Example: <code>60</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Address : `String`                               | <p>SFTP host address</p><p><br>Default: <code>-</code><br>Example: <code>localhost</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Port : `Int32`                                   | <p>Port number to use in the connection to the server.</p><p><br>Default: <code>22</code><br>Example: <code>22</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Authentication : `AuthenticationType`            | <p>Selection for authentication type</p><p>Possible values:</p><ul><li><code>UsernamePassword</code>:</li></ul><p>Selection for authentication type</p><ul><li><code>UsernamePrivateKeyFile</code>:</li></ul><p>Selection for authentication type</p><ul><li><code>UsernamePrivateKeyString</code>:</li></ul><p>Selection for authentication type</p><ul><li><code>UsernamePasswordPrivateKeyFile</code>:</li></ul><p>Selection for authentication type</p><ul><li><code>UsernamePasswordPrivateKeyString</code>:</li></ul><p>Selection for authentication type</p><p><br>Default: <code>-</code><br>Example: <code>AuthenticationType.UsernamePassword</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Username : `String`                              | <p>Username to use for authentication to the server. Note that the file endpoint only supports</p><p>username for remote shares and the username must be in the format DOMAIN\Username.</p><p><br>Default: <code>-</code><br>Example: <code>foo</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 🗝Password : `String`                            | <p>Password to use in the authentication to the server.</p><p><br>Default: <code>-</code><br>Example: <code>pass</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| PrivateKeyFile : `String`                        | <p>Full path to private key file. Supported private key formats: OpenSSH and ssh.com.</p><p>PuTTY keys can be converted with puttygen.exe application.</p><p>1. Load your key file into puttygen.exe</p><p>2. Conversion > Export OpenSSH key (not the "force new file format" option)</p><p><br>Default: <code>-</code><br>Example: <code>C:\path\to\private\key</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 🗝PrivateKeyString : `String`                    | <p>Private key as a string, supported private key formats: OpenSSH and ssh.com.</p><p>PuTTY keys can be converted with puttygen.exe application.</p><p>1. Load your key file into puttygen.exe</p><p>2. Conversion > Export OpenSSH key (not the "force new file format" option)</p><p><br>Default: <code>-</code><br>Example: <code>-----BEGIN RSA PRIVATE KEY----- Fqxq2jbSKyb0a+oW96Tjoif3Kcb5zZ0FiQyiHgQozLXrecjdUwjWuedkDoZMxwG5 bxpOnxZ/88tDzYCtCPcYCPRF8BNueUsZO8/tztTra+4NgVd/omXHG5bqb7iMB4dc ... OX7Q/wO4lqOlFhLtRnSL0cfuhRmt59pM75Zd+euX5tv9jmCj+AQT/kiBoMhNrDGk N2gTujnH7HCr/afSBeL3xnYcEmeCQTxTPZofBjPC+TPd9g7MntSGBeU/Fstv0jbg -----END RSA PRIVATE KEY-----</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 🗝PrivateKeyPassphrase : `String`                | <p>Passphrase for the private key file.</p><p><br>Default: <code>-</code><br>Example: <code>passphrase</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ServerFingerPrint : `String`                     | <p>Fingerprint of the SFTP server. When using "Username-Password"</p><p>authentication it is recommended to use server fingerprint in</p><p>order to be sure of the server you are connecting.</p><p><br>Default: <code>-</code><br>Example: <code>MD5: '41:76:EA:65:62:6E:D3:68:DC:41:9A:F2:F2:20:69:9D' SHA256: 'FBQn5eyoxpAl33Ly0gyScCGAqZeMVsfY7qss3KOM/hY='</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| HostKeyAlgorithm : `HostKeyAlgorithms`           | <p>Host key algorithm to use when connecting to server.</p><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><p>Possible values:</p><ul><li><code>Any</code>:</li></ul><p>Host key algorithm to use when connecting to server.</p><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><ul><li><code>RSA</code>:</li></ul><p>Host key algorithm to use when connecting to server.</p><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><ul><li><code>Ed25519</code>:</li></ul><p>Host key algorithm to use when connecting to server.</p><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><ul><li><code>nistp256</code>:</li></ul><p>Host key algorithm to use when connecting to server.</p><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><ul><li><code>nistp384</code>:</li></ul><p>Host key algorithm to use when connecting to server.</p><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><ul><li><code>nistp521</code>:</li></ul><p>Host key algorithm to use when connecting to server.</p><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><p><br>Default: <code>0</code><br>Example: <code>HostKeyAlgorithms.RSA</code></p> |
| UseKeyboardInteractiveAuthentication : `Boolean` | <p>Enable if the server uses keyboard-interactive authentication method.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| PromptAndResponse : `PromptResponse[]`           | <p>Responses for the server prompts when using Keyboard Interactive authentication method.</p><p><br>Default: <code>-</code><br>Example: <code>\[PromptResponse { Prompt = Verification code, Response = 123456789 } ]</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| BufferSize : `UInt32`                            | <p>Integer value of used buffer size as KB.</p><p>Default value is 32 KB.</p><p><br>Default: <code>32</code><br>Example: <code>32</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| {% endtab %}                                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

{% tab title="Result: Result" %}

| Name            | Description                                                                         |
| --------------- | ----------------------------------------------------------------------------------- |
| Path : `String` | <p>Path for the renamed file.<br>Example: <code>/test/folder/example.txt</code></p> |
| {% endtab %}    |                                                                                     |

{% tab title="Changelog" %}

## Changelog

### \[3.0.0] - 2026-01-27

#### Changed

**Breaking changes!**

* Updated dependency SSH.NET to the newest version 2025.1.0.
* Drop DSS support

### \[2.3.0] - 2026-01-13

#### Fixed

* Operation timeout is now using the Connection.ConnectionTimeout parameter.

### \[2.2.0] - 2025-01-10

#### Fixed

* Fixed issue with ConnectionInfoBuilder having static properties for connection and input parameters which lead to Task not being thread safe.

### \[2.1.0] - 2024-08-19

#### Updated

* Updated Renci.SshNet library to version 2024.1.0.

### \[2.0.0] - 2024-01-03

#### Updated

* \[Breaking] Updated dependency SSH.NET to the newest version 2023.0.0.

#### Changed

* Changed connection info builder to create the connection info as it's done in DownloadFiles.
* \[Breaking] Changed PrivateKeyFilePassphrase parameter to PrivateKeyPassphrase and enabled it when PrivateKeyString was used.

### \[1.0.0] - 2023-05-23

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
