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

WriteFile

Writes string content to a file through SFTP connection.

Task version: 3.0.0

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Task Parameters

Name
Description

Path : String

Full path of the target file to be written.

Default: / Example: /destination

Content : String

Text content to be written.

Default: - Example: This is test file

FileEncoding : 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.

  • Unicode: 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: 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.

Default: 1 Example: FileEncoding.ANSI

EnableBom : Boolean

Additional option for UTF-8 encoding to enable bom.

Default: False Example: true

EncodingInString : String

File encoding to be used.

Encoding don't support any unicode encoding. It only support the code page encodings.

A partial list of possible encodings: https://en.wikipedia.org/wiki/Windows_code_page#List.

Default: - Example: utf-8

WriteBehaviour : WriteOperation

How the file write should work if a file with the new name already exists.

Possible values:

  • Append: How the file write should work if a file with the new name already exists.

  • Overwrite: How the file write should work if a file with the new name already exists.

  • Error: How the file write should work if a file with the new name already exists.

Default: - Example: WriteOperation.Append

AddNewLine : Boolean

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

Default: False Example: true

Task Result

Name
Description

Path : String

Full path to the written file. Example: /destination/newfile.txt

SizeInMegaBytes : Double

Size of the new file in destination. Example: 3.2

Task Changelog

Changelog for Task Frends.SFTP.WriteFile.

[3.0.0] - 2026-01-27

Changed

Breaking changes!

  • Updated dependency SSH.NET to the newest version 2025.1.0.

  • Drop DSS support

[2.6.0] - 2026-01-13

Fixed

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

[2.5.0] - 2025-10-15

Added

  • Added new Options class with CreateDestinationDirectories property to enable automatic target directory creation

[2.4.0] - 2025-01-13

Fixed

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

[2.3.0] - 2024-08-19

Updated

  • Updated Renci.SshNet library to version 2024.1.0.

[2.2.0] - 2024-01-03

Updated

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

Changed

  • Changed connection info builder to create the connection info as it's done in DownloadFiles.

  • [Breaking] Changed PrivateKeyFilePassphrase parameter to PrivateKeyPassphrase and enabled it when PrivateKeyString was used.

[2.0.1] - 2022-12-01

Updated

  • Updated dependency Microsoft.Extensions.DependencyInjection to the newest version.

[2.0.0] - 2022-11-10

Changed

  • [Breaking] Added parameters for keyboard-interactive authentication and add new line when appending.

  • Fixed overwrite deleting the original file before writing the new file.

  • Added keyboard-interactive authentication method.

  • Added more tests e.g. Serverfingerprint tests

  • Added System.Text.CodePages NuGet to the project

  • Added ConnectionInfoBuilder

  • Added HostKeyAlgorithm enum

[1.0.1] - 2022-06-14

Changed

  • Changed the main method to write from stream to a file.

  • Updated tests

  • Updated Renci.SshNet library

[1.0.0] - 2022-03-10

Added

  • Initial implementation

Last updated

Was this helpful?