Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

UploadFiles

Uploads files through SFTP connection.

Task version: 4.4.0

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Task Parameters

Name
Description

Directory : String

Local directory.

Default: / Example: C:\directory</code>

FileName : String

File name or file mask of the files to be fetched.

Default: - Example: test.txt

IncludeSubdirectories : Boolean

Determines if subdirectories should be included when searching source files.

Depending on how many subdirectories there are, this operation can be extremely expensive.

Default: False Example: true

Action : SourceAction

What to do if source file is not found. Error = alarm and fail,

Info = alarm info and quit with success status, Ignore = quit

with success status.

Possible values:

  • Error: What to do if source file is not found. Error = alarm and fail,

Info = alarm info and quit with success status, Ignore = quit

with success status.

  • Info: What to do if source file is not found. Error = alarm and fail,

Info = alarm info and quit with success status, Ignore = quit

with success status.

  • Ignore: What to do if source file is not found. Error = alarm and fail,

Info = alarm info and quit with success status, Ignore = quit

with success status.

Default: Error Example: SourceAction.Error

Operation : SourceOperation

What to do with the source file after transfer.

Possible values:

  • Delete: Deletes the source file after transfer.

  • Rename: Renames the source file after transfer.

  • Move: Moves the source file after transfer.

  • Nothing: Leaves the source file unchanged.

Default: Delete Example: SourceOperation.Delete

FileNameAfterTransfer : String

Parameter for Rename operation. You can use file macros and also specify a directory

where to move the files to, e.g. C:\subdir%Date%file.txt. If you don't define a

directory path, the source directory is used. When using rename, this parameter

must always contain a file name.

Default: - Example: transferred.txt

DirectoryToMoveAfterTransfer : String

Parameter for Move operation. Set the full path to the directory without the

file name. You can use some macros in the directory name, e.g. C:\subdir%Year%_uploaded.

Default: - Example: C:\directory\transferred</code>

FilePaths : Object

The paths to the files to transfer, mainly meant to be used with the file trigger with the syntax: #trigger.data.filePaths

Type: System.Object[]

example: string[]

Default: - Example: #trigger.data.filePaths

Name
Description

Directory : String

Directory on the server.

Default: / Example: /upload/

FileName : String

File name of the destination file with possible macros.

Default: - Example: test.txt

FileNameEncoding : FileEncoding

If set, this ecoding will be used to encode and decode command

parameters and server responses, such as file names.

By selecting 'Other' you can use any encoding.

Possible values:

  • UTF8: If set, this ecoding will be used to encode and decode command

parameters and server responses, such as file names.

By selecting 'Other' you can use any encoding.

  • ANSI: If set, this ecoding will be used to encode and decode command

parameters and server responses, such as file names.

By selecting 'Other' you can use any encoding.

  • ASCII: If set, this ecoding will be used to encode and decode command

parameters and server responses, such as file names.

By selecting 'Other' you can use any encoding.

  • WINDOWS1252: If set, this ecoding will be used to encode and decode command

parameters and server responses, such as file names.

By selecting 'Other' you can use any encoding.

  • Other: Other enables users to add other encoding options as string.

Default: ANSI Example: FileEncoding.ANSI

EnableBomForFileName : Boolean

Additional option for UTF-8 encoding to enable bom.

Default: False Example: true

FileNameEncodingInString : String

File encoding to be used. A partial list of possible encodings: https://en.wikipedia.org/wiki/Windows_code_page#List.

Default: - Example: "utf-64"

Action : DestinationAction

Operation to determine what to do if destination file exists. Appending is not supported to Azure Blob Storage.

Possible values:

  • Append: Appends the file content to destination file if it exists.

  • Overwrite: Overwrites destination file if it exists.

  • Error: Throws exception if destination file exists.

Default: Error Example: DestinationAction.Error

AddNewLine : Boolean

If enabled new line is added to the existing file before appending the content.

Default: False Example: true

FileContentEncoding : FileEncoding

Encoding for the appending content. By selecting 'Other' you can use any encoding.

Possible values:

  • UTF8: Encoding for the appending content. By selecting 'Other' you can use any encoding.

  • ANSI: Encoding for the appending content. By selecting 'Other' you can use any encoding.

  • ASCII: Encoding for the appending content. By selecting 'Other' you can use any encoding.

  • WINDOWS1252: Encoding for the appending content. By selecting 'Other' you can use any encoding.

  • Other: Other enables users to add other encoding options as string.

Default: ANSI Example: FileEncoding.ANSI

FileContentEncodingInString : String

File encoding to be used. A partial list of possible encodings: https://en.wikipedia.org/wiki/Windows_code_page#List.

Default: - Example: utf-64

EnableBomForContent : Boolean

Additional option for UTF-8 encoding to enable bom.

Default: False Example: true

Name
Description

ConnectionTimeout : Int32

The lenght of time, in seconds, until the connection times out.

You can use value -1 to indicate that the connection does not time out.

Connection will only time out if the client is idle for assigned period of time.

Default value is 60 seconds.

Default: 60 Example: 60

KeepAliveInterval : Int32

The keep-alive interval in milliseconds. Interval the client send keep-alive packages to the host.

You can use value -1 to disable the keep-alive.

Default: -1 Example: -1

Address : String

SFTP host address

Default: - Example: localhost

Port : Int32

Port number to use in the connection to the server.

Default: 22 Example: 22

Authentication : AuthenticationType

Selection for authentication type

Possible values:

  • UsernamePassword: Authentication type which uses username and password.

  • UsernamePrivateKeyFile: Authentication type which uses username and private key file

  • UsernamePrivateKeyString: Authentication type which uses username and private key as a string.

  • UsernamePasswordPrivateKeyFile: Authentication type which uses username, password and private key file.

  • UsernamePasswordPrivateKeyString: Authentication type which uses username, password and private key as a string.

Default: - Example: AuthenticationType.UsernamePassword

UserName : String

Username to use for authentication to the server. Note that the file endpoint only supports

username for remote shares and the username must be in the format DOMAIN\Username.

Default: - Example: foo

🗝Password : String

Password to use in the authentication to the server.

Default: - Example: pass

PrivateKeyFile : String

Full path to private key file.

Default: - Example: C:\path\to\private\key

🗝PrivateKeyString : String

Private key as a string, supported private key formats: OpenSSH and ssh.com.

PuTTY keys can be converted with puttygen.exe application.

1. Load your key file into puttygen.exe

2. Conversion > Export OpenSSH key (not the "force new file format" option)

Default: - Example: -----BEGIN RSA PRIVATE KEY----- Fqxq2jbSKyb0a+oW96Tjoif3Kcb5zZ0FiQyiHgQozLXrecjdUwjWuedkDoZMxwG5 bxpOnxZ/88tDzYCtCPcYCPRF8BNueUsZO8/tztTra+4NgVd/omXHG5bqb7iMB4dc ... OX7Q/wO4lqOlFhLtRnSL0cfuhRmt59pM75Zd+euX5tv9jmCj+AQT/kiBoMhNrDGk N2gTujnH7HCr/afSBeL3xnYcEmeCQTxTPZofBjPC+TPd9g7MntSGBeU/Fstv0jbg -----END RSA PRIVATE KEY-----

🗝PrivateKeyPassphrase : String

Passphrase for the private key file.

Default: - Example: passphrase

ServerFingerPrint : String

Fingerprint of the SFTP server. When using "Username-Password"

authentication it is recommended to use server fingerprint in

order to be sure of the server you are connecting.

Default: - Example: MD5: '41:76:EA:65:62:6E:D3:68:DC:41:9A:F2:F2:20:69:9D' SHA256: 'FBQn5eyoxpAl33Ly0gyScCGAqZeMVsfY7qss3KOM/hY='

HostKeyAlgorithm : HostKeyAlgorithms

Host key algorithm to use when connecting to server.

Default value is Any which doesn't force the task to use

specific algorithm.

Possible values:

  • Any: The algorithm is negotiated with the server.

The task will use ed25519 as default.

  • RSA: Force the ssh-rsa host key algorithm.

  • Ed25519: Force the ssh-ed25519 host key algorithm.

  • nistp256: Force the ecdsa-sha2-nistp256 host key algorithm.

  • nistp384: Force the ecdsa-sha2-nistp384 host key algorithm.

  • nistp521: Force the ecdsa-sha2-nistp521 host key algorithm.

Default: Any Example: HostKeyAlgorithms.RSA

BufferSize : UInt32

Integer value of used buffer size as KB.

Default value is 32 KB.

Default: 32 Example: 32

UseKeyboardInteractiveAuthentication : Boolean

Enable if the server uses keyboard-interactive authentication method.

Default: False Example: false

PromptAndResponse : PromptResponse[]

Responses for the server prompts when using Keyboard Interactive authentication method.

Default: - Example: -

Name
Description

Timeout : Int32

Timeout in seconds when the Task is cancelled after.

Cancellation with the Timeout will stop the operation even if the transfer is occuring.

Task will try to restore the source file. Destination file will be deleted if the cancellation happens during the transfer.

Versus to the Connection.ConnectionTimeout which will only timeout the connection to the SFTP server if client is idle.

Number zero (0) or negative number will disable the timeout.

Default: 0 Example: 30

ThrowErrorOnFail : Boolean

Should an exception be thrown when file transfer fails.

Default: True Example: true

RenameSourceFileBeforeTransfer : Boolean

Should the destination file be renamed with temporary file name during file transfer as a locking mechanism.

Default: True Example: true

SourceFileExtension : String

File extension for the temporary source file which is used during the transfer.

Default: .8CO Example: .8CO

RenameDestinationFileDuringTransfer : Boolean

Should the destination file be renamed with temporary file name during file transfer as a locking mechanism.

Default: True Example: true

DestinationFileExtension : String

File extension for the temporary destination file which is used during the transfer.

Default: .8CO Example: .8CO

CreateDestinationDirectories : Boolean

Should the destination directories be created if they do not exist. May not work on all servers.

Default: False Example: true

PreserveLastModified : Boolean

Should the Last Modified timestamp be preserved from the source.

Default: False Example: true

OperationLog : Boolean

While enabled all operations logs of executions will be returned with the result.

Default: True Example: true

AssumeFileExistence : Boolean

If enabled, the Task will assume that the destination file exists and skip the checking of the destination file.

This option will automatically overwrite existing destination file with the same name as the transferred one.

This can help transfers with server when user has limited permissions to the destination directory e.g. no permission to do lstat command.

Default: False Example: false

Name
Description

TransferName : String

Optional descriptive name for the transfer.

Will be included in the file transfer log

entries and also in all error messages in the event log.

Default: "SFTPUpload" Example: SFTPUpload

WorkDir : String

Directory where temporary files are stored during transfer.

Default: - Example: C:\temp</code>

ProcessUri : String

The process URI, use #process.uri

Default: #process.uri Example: #process.uri

TaskExecutionID : String

Reference to the Task execution id, use #process.executionid

Default: #process.executionid Example: #process.executionid

Task Result

Name
Description

ActionSkipped : Boolean

Boolean value of the skipped Action. Example: false

Success : Boolean

Boolean value of the successful transfer. Example: true

UserResultMessage : String

Message of the transfer operations. Example: 1 files transferred: test.txt"

SuccessfulTransferCount : Int32

Count of files that has been successfully transferred. Example: 1

FailedTransferCount : Int32

Count of files that have not been transferred. Example: 0

TransferredFileNames : IEnumerable<String>

List of transferred file names. Example: [ "test.txt", "test2.txt" ]

TransferErrors : Dictionary<String, IList1>`

Dictionary of file names and errors messages of the failed transfers. Example: { 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.], ] }

TransferredFilePaths : IEnumerable<String>

List of transferred file paths. Example: [ "C:\test\test.txt", "C:\test\test2.txt" ]

TransferredDestinationFilePaths : String[]

List of destaintion file paths of the transferred files. Example: [ "upload/Upload/test.txt", "upload/Upload/test2.txt" ]

OperationsLog : IDictionary<String, String>

Operations logs for the transfer. Example: { "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" }

Task Changelog

Changelog for Task Frends.SFTP.UploadFiles.

[4.4.0] - 2026-10-21

Fixed

  • An empty or unknown encoding name now gives a clear error message ("Unknown encoding: '...'") instead of a NullReferenceException.

  • Fixed iso-8859-1 and other built-in .NET encodings not being found when entered as a custom encoding

[4.3.0] - 2026-07-08

Fixed

  • Fixed thread pool exhaustion in FileOperations

[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

Last updated

Was this helpful?