Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

rodry

Re: Append txt files fails WinSCP 6.5.5

Good News!
Winscp dll version 6.5.6 adding sessionOptions.AddRawSettings("SFTPMaxVersion", "5");
the file is append to existing file.
Thanks for support Martin

here partial log
> 2026-08-26 18:16:15.458 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2026-08-26 18:16:15.490 Type: SSH_FXP_VERSION, Size: 188, Number: -1
. 2026-08-26 18:16:15.490 SFTP version 5 negotiated.
. 2026-08-26 18:16:15.490 Server requests EOL sequence "\r\n".
. 2026-08-26 18:16:15.505 Server software: Cerberus FTP Server 2026.2.2.0 (-1214634480) by Redwood Software International, Inc.

2026-08-26 18:16:15.802 Binary transfer mode selected.
. 2026-08-26 18:16:15.802 Opening remote file.
> 2026-08-26 18:16:15.802 Type: SSH_FXP_OPEN, Size: 46, Number: 515
< 2026-08-26 18:16:15.834 Type: SSH_FXP_STATUS, Size: 22, Number: 515
< 2026-08-26 18:16:15.849 Status code: 4, Message: 515, Server: , Language: en-US
. 2026-08-26 18:16:15.849 Cannot create new file "/TEST.txt", checking if it exists already
> 2026-08-26 18:16:15.849 Type: SSH_FXP_LSTAT, Size: 29, Number: 775
< 2026-08-26 18:16:15.880 Type: SSH_FXP_ATTRS, Size: 58, Number: 775
> 2026-08-26 18:16:15.880 Type: SSH_FXP_OPEN, Size: 38, Number: 1027
< 2026-08-26 18:16:15.927 Type: SSH_FXP_HANDLE, Size: 47, Number: 1027
. 2026-08-26 18:16:15.927 Appending file.
> 2026-08-26 18:16:15.927 Type: SSH_FXP_WRITE, Size: 3951, Number: 1542
> 2026-08-26 18:16:15.927 Type: SSH_FXP_CLOSE, Size: 47, Number: 1796
< 2026-08-26 18:16:15.974 Type: SSH_FXP_STATUS, Size: 22, Number: 1542
< 2026-08-26 18:16:15.974 Status code: 0
< 2026-08-26 18:16:16.052 Type: SSH_FXP_STATUS, Size: 22, Number: 1796
< 2026-08-26 18:16:16.052 Status code: 0
. 2026-08-26 18:16:16.052 Transfer done

martin wrote:

Thanks for the logs.
It seems to be a bug in the server. Combined with this change in WinSCP that is meant as a workaround against common bugs in SFTP server:
Issue 2247 – Limiting SFTP version to 3 with non-well-known SFTP servers as a workaround for interoperability issues

SFTP protocol versions higher than 3 are rarely supported, hence badly tested and commonly buggy. For this reason WinSCP in recent versions do not employ never SFTP versions with less known servers. But your server actually seems to have the appending correctly implemented in SFTP version 5 (used by older versions of WinSCP), but has it broken in SFTP version 3 (used by the latest version of WinSCP).
You can "fix" that by forcing WinSCP to use SFTP version 5:
sessionOptions.AddRawSettings("SFTPMaxVersion", "5");
rodry

Re: Append txt files fails WinSCP 6.5.5

Hy Martin, many thanks for your support!
Next days I'll try to integrate your suggestion!

Marco
martin

Re: Append txt files fails WinSCP 6.5.5

Thanks for the logs.
It seems to be a bug in the server. Combined with this change in WinSCP that is meant as a workaround against common bugs in SFTP server:
Issue 2247 – Limiting SFTP version to 3 with non-well-known SFTP servers as a workaround for interoperability issues

SFTP protocol versions higher than 3 are rarely supported, hence badly tested and commonly buggy. For this reason WinSCP in recent versions do not employ never SFTP versions with less known servers. But your server actually seems to have the appending correctly implemented in SFTP version 5 (used by older versions of WinSCP), but has it broken in SFTP version 3 (used by the latest version of WinSCP).
You can "fix" that by forcing WinSCP to use SFTP version 5:
sessionOptions.AddRawSettings("SFTPMaxVersion", "5");
rodry

Append txt files fails WinSCP 6.5.5

Hello I'm trying to append a text file source.txt to a file destination.txt on remote folder with WinSCP Version 6.5.5 (Build 16453 2025-11-19) – also last 6.6.2 but the file is always overwritten.
Instead using an old WinSCP dll (5.19.3) the file is append to destination.txt.
Source code is the same (I change only winscp.dll and winscp.exe references in my project). I have analyzed the attached log files, and it appears that the two DLLs behave differently: version 6.5.5 processes the remote server's response incorrectly, whereas version 5.19.3 handles it correctly. For the time being, I am using the older version, but I would like to determine whether the issue lies with the DLL or the remote server. Many thanks.