# DeleteFiles

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.DeleteFiles>

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

| Name                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Directory : `String`          | <p>Full path of the target file to be deleted.</p><p><br>Default: <code>/</code><br>Example: <code>/destination</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| FileMask : `String`           | <p>Pattern to match (Optional).</p><p><br>Default: <code>-</code><br>Example: <code>\*.txt</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| FilePaths : `Object`          | <p>The paths to the files to be deleted, mainly meant to be used with the file trigger with the syntax: #trigger.data.filePaths</p><p><br>Default: <code>-</code><br>Example: <code>#trigger.data.filePaths</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| FileEncoding : `FileEncoding` | <p>If set, this ecoding will be used to encode and decode command</p><p>parameters and server responses, such as file names.</p><p>By selecting 'Other' you can use any encoding.</p><p>Possible values:</p><ul><li><code>UTF8</code>:</li></ul><p>If set, this ecoding will be used to encode and decode command</p><p>parameters and server responses, such as file names.</p><p>By selecting 'Other' you can use any encoding.</p><ul><li><code>ANSI</code>:</li></ul><p>If set, this ecoding will be used to encode and decode command</p><p>parameters and server responses, such as file names.</p><p>By selecting 'Other' you can use any encoding.</p><ul><li><code>ASCII</code>:</li></ul><p>If set, this ecoding will be used to encode and decode command</p><p>parameters and server responses, such as file names.</p><p>By selecting 'Other' you can use any encoding.</p><ul><li><code>WINDOWS1252</code>:</li></ul><p>If set, this ecoding will be used to encode and decode command</p><p>parameters and server responses, such as file names.</p><p>By selecting 'Other' you can use any encoding.</p><ul><li><code>Unicode</code>:</li></ul><p>If set, this ecoding will be used to encode and decode command</p><p>parameters and server responses, such as file names.</p><p>By selecting 'Other' you can use any encoding.</p><ul><li><code>Other</code>:</li></ul><p>If set, this ecoding will be used to encode and decode command</p><p>parameters and server responses, such as file names.</p><p>By selecting 'Other' you can use any encoding.</p><p><br>Default: <code>1</code><br>Example: <code>FileEncoding.ANSI</code></p> |
| EnableBom : `Boolean`         | <p>Additional option for UTF-8 encoding to enable bom.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| EncodingInString : `String`   | <p>File encoding to be used.</p><p>Encoding don't support any unicode encoding. It only support the code page encodings.</p><p>A partial list of possible encodings: <https://en.wikipedia.org/wiki/Windows_code_page#List>.</p><p><br>Default: <code>-</code><br>Example: <code>utf-8</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> |
| 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>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 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>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| {% endtab %}                                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

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

| Name                     | Description                                                                                       |
| ------------------------ | ------------------------------------------------------------------------------------------------- |
| Files : `List<FileItem>` | <p>List of file items deleted from directory.<br>Example: <code>\[test.txt, test2.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-13

#### Fixed

* Fixed issue with ConnectionInfoBuilder having static properties for connection and input parameters which led 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-02

#### 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.

### \[1.0.0] - 2023-09-01

#### Changed

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