Re: WinSCP batch - file transfer happens sometimes only
I have a last query 'Can we rotate the logs based on size/date ?'
You can use
/logsize
command-line switch:
https://winscp.net/eng/docs/commandline#logging
I have a last query 'Can we rotate the logs based on size/date ?'
/logsize
command-line switch:
You are starting WinSCP withC:\Windows\system32
as the startup/working directory and you try to upload files*.csv
from there. It's no surprise that there are no such files.
. 2019-11-27 14:55:00.142 Working directory: C:\Windows\system32
...
> 2019-11-27 15:00:02.366 Script: put *.csv
< 2019-11-27 15:00:02.366 Script: No file matching '*.csv' found.
Either set the startup directory to the folder where you files are; or uselcd
command beforeput
to change the working directory to that folder. Or use a full source path in theput
command.
C:\Windows\system32
as the startup/working directory and you try to upload files *.csv
from there. It's no surprise that there are no such files.
. 2019-11-27 14:55:00.142 Working directory: C:\Windows\system32
...
> 2019-11-27 15:00:02.366 Script: put *.csv
< 2019-11-27 15:00:02.366 Script: No file matching '*.csv' found.
lcd
command before put
to change the working directory to that folder. Or use a full source path in the put
command.
Bottom line is manual trigger working properly but not automated one
Please help us out on this.
Again, post a log file please.
Bottom line is manual trigger working properly but not automated one
Please help us out on this.
Please attach a full session log file showing the problem (using the latest version of WinSCP). Please include a log file both from a successful and a failed session.
@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\sftp\logs\sftp_log.log" /ini=nul ^
/command ^
"open sftp://xxxxxxxxx/ -hostkey=""ssh-ed25519 256 d7Te2DHmvBNSWJNBWik2KbDTjmWtYHe2bvXTMM9lVg4=""" ^
"cd /IN" ^
"put *.*" ^
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
exit /b %WINSCP_RESULT%