> For the complete documentation index, see [llms.txt](https://docs.frends.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frends.com/tasks/tasks/sftp/uploadfiles.md).

# UploadFiles

Task version: 4.2.0

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

## Task Parameters

{% tabs %}
{% tab title="Source" %}

| Name                                    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Directory : `String`                    | <p>Local directory.</p><p><br>Default: <code>/</code><br>Example: <code>C:\directory\</code></code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| FileName : `String`                     | <p>File name or file mask of the files to be fetched.</p><p><br>Default: <code>-</code><br>Example: <code>test.txt</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| IncludeSubdirectories : `Boolean`       | <p>Determines if subdirectories should be included when searching source files.</p><p>Depending on how many subdirectories there are, this operation can be extremely expensive.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| Action : `SourceAction`                 | <p>What to do if source file is not found. Error = alarm and fail,</p><p>Info = alarm info and quit with success status, Ignore = quit</p><p>with success status.</p><p>Possible values:</p><ul><li><code>Error</code>: What to do if source file is not found. Error = alarm and fail,</li></ul><p>Info = alarm info and quit with success status, Ignore = quit</p><p>with success status.</p><ul><li><code>Info</code>: What to do if source file is not found. Error = alarm and fail,</li></ul><p>Info = alarm info and quit with success status, Ignore = quit</p><p>with success status.</p><ul><li><code>Ignore</code>: What to do if source file is not found. Error = alarm and fail,</li></ul><p>Info = alarm info and quit with success status, Ignore = quit</p><p>with success status.</p><p><br>Default: <code>0</code><br>Example: <code>SourceAction.Error</code></p> |
| Operation : `SourceOperation`           | <p>What to do with the source file after transfer.</p><p>Possible values:</p><ul><li><code>Delete</code>: What to do with the source file after transfer.</li><li><code>Rename</code>: What to do with the source file after transfer.</li><li><code>Move</code>: What to do with the source file after transfer.</li><li><code>Nothing</code>: What to do with the source file after transfer.</li></ul><p><br>Default: <code>0</code><br>Example: <code>SourceOperation.Delete</code></p>                                                                                                                                                                                                                                                                                                                                                                                            |
| FileNameAfterTransfer : `String`        | <p>Parameter for Rename operation. You can use file macros and also specify a directory</p><p>where to move the files to, e.g. C:\subdir%Date%file.txt. If you don't define a</p><p>directory path, the source directory is used. When using rename, this parameter</p><p>must always contain a file name.</p><p><br>Default: <code>-</code><br>Example: <code>transferred.txt</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| DirectoryToMoveAfterTransfer : `String` | <p>Parameter for Move operation. Set the full path to the directory without the</p><p>file name. You can use some macros in the directory name, e.g. C:\subdir%Year%\_uploaded.</p><p><br>Default: <code>-</code><br>Example: <code>C:\directory\transferred\</code></code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| FilePaths : `Object`                    | <p>The paths to the files to transfer, mainly meant to be used with the file trigger with the syntax: #trigger.data.filePaths</p><p>Type: System.Object\[]</p><p>example: string\[]</p><p><br>Default: <code>-</code><br>Example: <code>#trigger.data.filePaths</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| {% endtab %}                            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

{% tab title="Destination" %}

| Name                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Directory : `String`                   | <p>Directory on the server.</p><p><br>Default: <code>/</code><br>Example: <code>/upload/</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| FileName : `String`                    | <p>File name of the destination file with possible macros.</p><p><br>Default: <code>-</code><br>Example: <code>test.txt</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| FileNameEncoding : `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>: If set, this ecoding will be used to encode and decode command</li></ul><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>: If set, this ecoding will be used to encode and decode command</li></ul><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>: If set, this ecoding will be used to encode and decode command</li></ul><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>: If set, this ecoding will be used to encode and decode command</li></ul><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>: If set, this ecoding will be used to encode and decode command</li></ul><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> |
| EnableBomForFileName : `Boolean`       | <p>Additional option for UTF-8 encoding to enable bom.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| FileNameEncodingInString : `String`    | <p>File encoding to be used. 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-64"</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Action : `DestinationAction`           | <p>Operation to determine what to do if destination file exists. Appending is not supported to Azure Blob Storage.</p><p>Possible values:</p><ul><li><code>Append</code>: Operation to determine what to do if destination file exists. Appending is not supported to Azure Blob Storage.</li><li><code>Overwrite</code>: Operation to determine what to do if destination file exists. Appending is not supported to Azure Blob Storage.</li><li><code>Error</code>: Operation to determine what to do if destination file exists. Appending is not supported to Azure Blob Storage.</li></ul><p><br>Default: <code>2</code><br>Example: <code>DestinationAction.Error</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| AddNewLine : `Boolean`                 | <p>If enabled new line is added to the existing file before appending the content.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| FileContentEncoding : `FileEncoding`   | <p>Encoding for the appending content. By selecting 'Other' you can use any encoding.</p><p>Possible values:</p><ul><li><code>UTF8</code>: Encoding for the appending content. By selecting 'Other' you can use any encoding.</li><li><code>ANSI</code>: Encoding for the appending content. By selecting 'Other' you can use any encoding.</li><li><code>ASCII</code>: Encoding for the appending content. By selecting 'Other' you can use any encoding.</li><li><code>WINDOWS1252</code>: Encoding for the appending content. By selecting 'Other' you can use any encoding.</li><li><code>Other</code>: Encoding for the appending content. By selecting 'Other' you can use any encoding.</li></ul><p><br>Default: <code>1</code><br>Example: <code>FileEncoding.ANSI</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| FileContentEncodingInString : `String` | <p>File encoding to be used. 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-64</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| EnableBomForContent : `Boolean`        | <p>Additional option for UTF-8 encoding to enable bom.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| {% endtab %}                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

{% tab title="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>Connection will only time out if the client is idle for assigned period of time.</p><p>Default value is 60 seconds.</p><p><br>Default: <code>60</code><br>Example: <code>60</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| KeepAliveInterval : `Int32`                      | <p>The keep-alive interval in milliseconds. Interval the client send keep-alive packages to the host.</p><p>You can use value -1 to disable the keep-alive.</p><p><br>Default: <code>-1</code><br>Example: <code>-1</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>: Selection for authentication type</li><li><code>UsernamePrivateKeyFile</code>: Selection for authentication type</li><li><code>UsernamePrivateKeyString</code>: Selection for authentication type</li><li><code>UsernamePasswordPrivateKeyFile</code>: Selection for authentication type</li><li><code>UsernamePasswordPrivateKeyString</code>: Selection for authentication type</li></ul><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.</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>: Host key algorithm to use when connecting to server.</li></ul><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><ul><li><code>RSA</code>: Host key algorithm to use when connecting to server.</li></ul><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><ul><li><code>Ed25519</code>: Host key algorithm to use when connecting to server.</li></ul><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><ul><li><code>nistp256</code>: Host key algorithm to use when connecting to server.</li></ul><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><ul><li><code>nistp384</code>: Host key algorithm to use when connecting to server.</li></ul><p>Default value is Any which doesn't force the task to use</p><p>specific algorithm.</p><ul><li><code>nistp521</code>: Host key algorithm to use when connecting to server.</li></ul><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>-</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| {% endtab %}                                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

{% tab title="Options" %}

| Name                                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Timeout : `Int32`                               | <p>Timeout in seconds when the Task is cancelled after.</p><p>Cancellation with the Timeout will stop the operation even if the transfer is occuring.</p><p>Task will try to restore the source file. Destination file will be deleted if the cancellation happens during the transfer.</p><p>Versus to the Connection.ConnectionTimeout which will only timeout the connection to the SFTP server if client is idle.</p><p>Number zero (0) or negative number will disable the timeout.</p><p><br>Default: <code>0</code><br>Example: <code>30</code></p> |
| ThrowErrorOnFail : `Boolean`                    | <p>Should an exception be thrown when file transfer fails.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                          |
| RenameSourceFileBeforeTransfer : `Boolean`      | <p>Should the destination file be renamed with temporary file name during file transfer as a locking mechanism.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                     |
| SourceFileExtension : `String`                  | <p>File extension for the temporary source file which is used during the transfer.</p><p><br>Default: <code>.8CO</code><br>Example: <code>.8CO</code></p>                                                                                                                                                                                                                                                                                                                                                                                                  |
| RenameDestinationFileDuringTransfer : `Boolean` | <p>Should the destination file be renamed with temporary file name during file transfer as a locking mechanism.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                     |
| DestinationFileExtension : `String`             | <p>File extension for the temporary destination file which is used during the transfer.</p><p><br>Default: <code>.8CO</code><br>Example: <code>.8CO</code></p>                                                                                                                                                                                                                                                                                                                                                                                             |
| CreateDestinationDirectories : `Boolean`        | <p>Should the destination directories be created if they do not exist. May not work on all servers.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                |
| PreserveLastModified : `Boolean`                | <p>Should the Last Modified timestamp be preserved from the source.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                |
| OperationLog : `Boolean`                        | <p>While enabled all operations logs of executions will be returned with the result.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                |
| AssumeFileExistence : `Boolean`                 | <p>If enabled, the Task will assume that the destination file exists and skip the checking of the destination file.</p><p>This option will automatically overwrite existing destination file with the same name as the transferred one.</p><p>This can help transfers with server when user has limited permissions to the destination directory e.g. no permission to do lstat command.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                          |
| {% endtab %}                                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

{% tab title="Info" %}

| Name                       | Description                                                                                                                                                                                                                                        |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| TransferName : `String`    | <p>Optional descriptive name for the transfer.</p><p>Will be included in the file transfer log</p><p>entries and also in all error messages in the event log.</p><p><br>Default: <code>"SFTPUpload"</code><br>Example: <code>SFTPUpload</code></p> |
| WorkDir : `String`         | <p>Directory where temporary files are stored during transfer.</p><p><br>Default: <code>-</code><br>Example: <code>C:\temp\</code></code></p>                                                                                                      |
| ProcessUri : `String`      | <p>The process URI, use #process.uri</p><p><br>Default: <code>#process.uri</code><br>Example: <code>#process.uri</code></p>                                                                                                                        |
| TaskExecutionID : `String` | <p>Reference to the Task execution id, use #process.executionid</p><p><br>Default: <code>#process.executionid</code><br>Example: <code>#process.executionid</code></p>                                                                             |
| {% endtab %}               |                                                                                                                                                                                                                                                    |
| {% endtabs %}              |                                                                                                                                                                                                                                                    |

## Task Result

| Name                                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ActionSkipped : `Boolean`                       | <p>Boolean value of the skipped Action.<br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Success : `Boolean`                             | <p>Boolean value of the successful transfer.<br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| UserResultMessage : `String`                    | <p>Message of the transfer operations.<br>Example: <code>1 files transferred: test.txt"</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| SuccessfulTransferCount : `Int32`               | <p>Count of files that has been successfully transferred.<br>Example: <code>1</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| FailedTransferCount : `Int32`                   | <p>Count of files that have not been transferred.<br>Example: <code>0</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| TransferredFileNames : `IEnumerable<String>`    | <p>List of transferred file names.<br>Example: <code>\[ "test.txt", "test2.txt" ]</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| TransferErrors : `Dictionary<String, IList`1>\` | <p>Dictionary of file names and errors messages of the failed transfers.<br>Example: <code>{ test.txt : \[ Failure in CheckIfDestinationFileExists: File 'test.txt' could not be transferred to '/upload/Upload'. Error: Unable to transfer file. Destination file already exists: test.txt \[Source file restored.], ] text2.txt : \[ Failure in CheckIfDestinationFileExists: File 'test2.txt' could not be transferred to '/upload/Upload'. Error: Unable to transfer file. Destination file already exists: test2.txt \[Source file restored.], ] }</code></p> |
| TransferredFilePaths : `IEnumerable<String>`    | <p>List of transferred file paths.<br>Example: <code>\[ "C:\test\test.txt", "C:\test\test2.txt" ]</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| TransferredDestinationFilePaths : `String[]`    | <p>List of destaintion file paths of the transferred files.<br>Example: <code>\[ "upload/Upload/test.txt", "upload/Upload/test2.txt" ]</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                  |
| OperationsLog : `IDictionary<String, String>`   | <p>Operations logs for the transfer.<br>Example: <code>{ "2022-05-30 12:27:35.00Z": "FILE LIST C:\test\test.txt" "2022-06-01 11:01:50.40Z": "RenameSourceFileBeforeTransfer: Renaming source file test.txt to temporary file name frends\_637896781104694806az33q4kf.8CO before transfer" }</code></p>                                                                                                                                                                                                                                                             |

## Task Changelog

Changelog for Task Frends.SFTP.UploadFiles.

### \[4.2.0] - 2026-05-27

#### Fixed

* Fixed NullReferenceException when using FilePaths parameter with null or empty Directory value.

### \[4.1.0] - 2026-05-22

#### Added

* Added new parameter Source.IncludeSubdirectories which enables recursive file search from subdirectories. Default value is false to maintain backward compatibility.
* Added support for %SourceRelativeDirectory% macro in Destination.Directory. This macro preserves the source folder structure during upload when used with IncludeSubdirectories=true. For files in the root source directory, the macro expands to an empty string. Example: for source 'C:\upload' and file 'C:\upload\sub1\sub2\file.txt', the macro expands to 'sub1/sub2/'.

### \[4.0.0] - 2026-04-26

#### Changed

* Drop support for .NET Framework 4.7.1 and .NET Standard 2.0.

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

#### Changed

**Breaking changes!**

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

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

#### Fixed

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

### \[2.13.0] - 2026-01-12

#### Fixed

* The default Source.FileName is "". "" means that it matches all files (same behavior as for "\*")
* Improved asynchronous logic and cancellation token timeout handling

### \[2.12.0] - 2025-05-20

#### Fixed

* Improved directory creation logic for SFTP uploads, enhancing reliability when creating nested directories.

### \[2.11.0] - 2024-09-16

#### Fixed

* Fixed memory leak with Cancellation token source by disposing the token source at finally block.
* Fixed issue with temp files leaving inside the source directory by adding check for them in clean up method.

### \[2.10.0] - 2024-08-16

#### Updated

* Updated Renci.SshNet library to version 2024.1.0.

### \[2.9.0] - 2023-12-13

#### Changed

* \[Breaking] Changed Result property TransferredDestinationFilePaths to string array.
* Changed SftpClient operations to use async methods with CancellationToken.

#### Fixed

* Fixed issue where single failure stops other file transfers when using FilePaths.
* Fixed issue where Task can't be cancelled from UI. Change enables users to terminate the transfer even if file upload is ongoing.

#### Updated

* Updated Renci.SshNet library to the newest version 2023.0.0.

#### Added

* Added FileOperations class which handles file operations as async with CancellationToken e.g. Append, Copy, Move.
* Added Timeout Option which will stop the Task when the operation takes enough time.

### \[2.8.0] - 2023-10-18

#### Added

* \[Breaking] New feature: Added parameter AssumeFileExistence which will when enabled, skip checking if destination file esists and overwrites any existing files automatically.

### \[2.7.2] - 2023-09-20

#### Fixed

* Fixed issue with empty destination directory by adding forward slash to the parameter if it's empty.

### \[2.7.1] - 2023-07-25

#### Added

* Added SFTPClient.OperationTimeout which should cause timeout during operations if the Task becomes stuck.

### \[2.7.0] - 2023-06-08

#### Added

* \[Breaking] Added new parameter for keyboard-interactive authentication where users can add prompts and responses.
* Modified operations log to list current system and sftp server information.

#### Fixed

* Modified private key passphrase to be visible when all private key authentication options were enabled.
* Fixed operations log to show case exceptions more precisely.

### \[2.6.1] - 2023-05-17

#### Fixed

* Fixed issue with TransferredFileNames was incorrect when FilePaths parameter was used.

### \[2.6.0] - 2023-05-16

#### Added

* Added new result attribute TransferredDestinationFilePaths list consisting of the file paths of destination files.

### \[2.5.5] - 2023-05-05

#### Fixed

* Fixed Permission denied error when using mounted CIFS share by canonizing the destination path.

### \[2.5.4] - 2023-02-24

#### Fixed

* Fixed bug with task trying to rename the source file after exception without it being renamed in the first place.

### \[2.5.3] - 2023-02-21

#### Fixed

* Fixed bug with FilePaths when using list of objects in parameter.
* Documentational fixes to the FilePaths parameter.

### \[2.5.2] - 2023-02-14

#### Added

* Re-enabled key exchange algorithms 'curve25519-sha256' and '<curve25519-sha256@libssh.org>'.

### \[2.5.1] - 2023-02-09

#### Added

* Added cancellationToken to method ListSourceFiles so Task's execution can be terminated via Frends.

### \[2.5.0] - 2022-12-30

#### Fixed

* \[Breaking] Fixed issue where keepaliveinterval and operationtimeout is set as the connectiontimeout by creating them for the keepaliveinterval its own parameter and removed operationtimeout.

### \[2.4.1] - 2022-12-01

#### Updated

* Updated dependencies System.Text.Encoding.CodePages and Microsoft.Extensions.DependencyInjection to the newest version.
* Modified test to run against net471 instead of net6.

### \[2.4.0]

#### Added

* \[Breaking] Added parameters for the file extension of temporary source and destination files when rename options are enabled.
* Fixed operations log to show correct state when source files are not found with filePaths.
* Fixed operations log to use temp work path when getting source files to temp directory.
* Added tests for the filePaths.

### \[2.3.0] - 2022-10-12

#### Added

* Added boolean parameter for adding a new line when appending to an existing file.
* Changed the appending to use AppendAllText instead of AppendAllLines.

### \[2.2.3] - 2022-10-12

#### Fixed

* Fixed OperationTimeout and KeepAliveInterval attributes to use directly user input.

### \[2.2.2] - 2022-10-03

#### Added

* Added OperationTimeout and KeepAliveInterval attributes to SftpClient and set them to same value as the ConnectionTimeout parameter.

### \[2.2.1] - 2022-09-30

#### Fixed

* Added possibility to give different directory to the task when using SourceOperation.Rename.
* Updated documentation.

### \[2.2.0] - 2022-09-28

#### Fixed

* \[Breaking] Added option to enable keyboard-interactive authentication method. This change will break the automatic updates of the task.
* Fixed issue with connecting to server which uses keyboard-interactive authentication method. Fixed by adding UseKeyboardInteractiveAuthentication parameter and handled the method inside tha task.

### \[2.1.3] - 2022-09-23

#### Fixed

* Fixed issue with the error message by changing how the error message is build. Error message had 'SFTP://' in both endpoints.

### \[2.1.2] - 2022-09-16

#### Fixed

* Fixed error handler by adding connection check to FileTransporter and SingleFileTransfer classes. If the client is not connected the task tries to connect again before handling errors.
* Added some tests and separated Appending tests to their own class.

### \[2.1.1] - 2022-09-14

#### Updated

* Updated depricated library Microsoft.Extensions.DependencyInjection from 5.0.1 to 6.0.0

### \[2.1.0] - 2022-09-08

#### Fixed

* \[Beaking] Removed UTF-16 and Unicode FileEncoding because their implementation didn't work. These were used as a parameter so autoupdate won't work.
* Fixed how the Encoding on windows-1252 is handled. Added NuGet System.Text.Encoding.CodePages which can handle that encoding.
* Fixed error handling by adding catch to FileTransporter to catch SftpPathNotFoundException and general Exception.
* Added HostKeyAlgorithm parameter which enables users to change the host key algorithm used in the task. Before task defaults to ED25519.
* Added tests to test the file name and content encoding.
* Updated the document to state that Ssh.Net only supports private keys in OpenSSH and ssh.com formats.
* Added documentation on the private key formatingm from putty.ppk to OpenSSH.
* Moved all the SourceOperation tests to their own test class.
* Fixed issue with server fingerprint given by user in SHA256 hex format was not accepted: Added conversion to the fingerprint given by user.
* Fixed issue when using invalid server fingerprint in MD5 string format throws wrong error message: Added more specific error messages.
* Changed how MD5 string is handled. MD5 can now be given without ':' or '-' characters.
* Fixed issue that Sha256 was only accepted in Base64 format: Added support for Sha256 in hex format.
* Added selector for host key algorithm which when enabled will force the task to use specific algorithm.
* Added more tests for using server fingerprints.
* Fixed issue where when using SourceOperation.Move the source file cannot be restored when exception occurs.

### \[2.0.0] - 2022-08-08

#### Fixed

* \[Breaking] Changed the implementation to work similar to Cobalt by moving the source file to local Temp folder before transferring to destination.
* Fixed issue where PreserveModified caused exceptions because the method used wrong file path.
* Fixed bug where source files were deleted if RenameSourceFileBeforeTransfer was enabled and SourceOperation.Move had directory that didn't exist.
* Added logger usage in places where it was needed to make the operations log and error info more informative.
* Modified the logger usage that the logger.NotifyInformation is done after the action so it's easier to see where errors has occurred.

### \[1.0.2] - 2022-06-08

#### Fixed

* Fixed Source Operations removed source file when RenameSourceFileBeforeTransfer was enabled and transfer failed.
* Fixed Destination file being removed when RenameDestinationFileDuringTransfer was enabled and transfer failed.
* Removed permission changes to destination file.
* Fixed documentation.

### \[1.0.1] - 2022-06-07

#### Fixed

* Cleaned up test files, added more test for macros, fixed source file rename and move after transfer

### \[1.0.0] - 2022-05-24

#### Added

* Initial implementation


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.frends.com/tasks/tasks/sftp/uploadfiles.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
