Append txt files fails WinSCP 6.5.5

Advertisement

rodry
Joined:
Posts:
2
Location:
Italia

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
43,038
Location:
Prague, Czechia

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 servers 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");

Reply with quote

rodry
Joined:
Posts:
2
Location:
Italia

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

Reply with quote

Advertisement

You can post new topics in this forum