Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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)


Topic review


So it seems like there is packet loss between the local and remote destination for some reason. I got it working with the following hack:

@echo off

set TRIES=10


"C:\Program Files (x86)\WinSCP\" ^
/log="C:\Users\Administrator\Documents\XXX\WinSCP.log" /ini=nul ^
/command ^
"open sftp://XXX="" -privatekey=""C:\Users\Administrator\Documents\XXX\XXX.ppk""" ^
"lcd C:\Users\Administrator\Documents\XXX" ^
"cd ""/XXX/XXX""" ^
"option batch continue" ^
"rm XXX.xlsm" ^
"put XXX.xlsm" ^
"exit" ^

if %ERRORLEVEL% neq 0 (
set /A TRIES=%TRIES%-1
if %TRIES% gtr 1 (
echo Failed, retrying in %INTERVAL% seconds...
timeout /t %INTERVAL%
goto retry
) else (
echo Failed, aborting
exit /b 1

echo Success
exit /b 0

Basically I keep retrying to upload until the partial file is complete. Not sure how robust this will be going forward, please let me know if you have a better solution!

Error 4

Whenever I try to drag and drop (or use a bat file) to copy over a 10mb .xlsm file using WinSCP only a part of the file copies over (varying size between 2mb to 8 mb) I get Error code: 4

As far I as I can tell this is not due to:
- Renaming a file to a name of already existing file - I've made sure an existing file with the same file does not exist
- Uploading to a full file system/exceeding disk quota - If I try to upload the file using FileZilla I do not get any issue so surely disk space or user disk quota cannot be an issue?

The strangest of all is when I execute a bat file to upload the file from windows task scheduler it SOMETIMES works and sometimes not. I've tried running WINSCP and the bat file "as administrator" so I don't think this is a permissions thing.

Any other fixes I can try?


EDIT: interestingly I noticed in FileZilla the upload fails once or twice sometimes but FileZilla automatically retries and uploads the file on the second or third time. This is the error FileZilla gives before going ahead:
Error: error while writing: received failure with description 'Failure'
Error: File transfer failed after transferring 6 717 440 bytes in 6 seconds

EDIT2: Uploaded log file