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

UploadFiles

Uploads files through SFTP connection.

Task version: 4.2.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: 0 Example: SourceAction.Error

Operation : SourceOperation

What to do with the source file after transfer.

Possible values:

  • Delete: What to do with the source file after transfer.

  • Rename: What to do with the source file after transfer.

  • Move: What to do with the source file after transfer.

  • Nothing: What to do with the source file after transfer.

Default: 0 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

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