Re: Script creation
Good day. Could you tell me if the following is okay.
No. That's all wrong. See
https://winscp.net/eng/docs/faq_batch_file#cmd
https://winscp.net/eng/docs/guide_automation
Good day. Could you tell me if the following is okay.
@echo off
open scp://suchas:random45@200.34.56.78/ -hostkey="ssh-rsa 2048 fG5h60iJKillL3YUlcZkcqQniqX1Pj="
cd /resp_expdp/DIARY_CH
get %TIMESTAMP-1D#yyyy-mm-dd%*.* d:\
exit
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
exit /b %WINSCP_RESULT%
%
signs:
"cd /ucpex/P/eurex/%%TIMESTAMP-1D#YYYYMMDD%%/" ^
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="D:\BATCHES\LOGS\CRE_WINSCP.log" /ini=nul ^
/command ^
"open sftp://....." ^
"cd /ucpex/P/eurex/%TIMESTAMP-1D#YYYYMMDD%/" ^
"get *XML.ZIP D:\BATCHES\TEMP_FILES" ^
"exit"
...
. 2019-04-10 09:29:17.851 Startup conversation with host finished.
< 2019-04-10 09:29:17.851 Script: Active session: [1] 1059233_000002@193.29.90.132
> 2019-04-10 09:29:17.852 Script: cd /ucpex/P/eurex//
. 2019-04-10 09:29:17.852 Changing directory to "/ucpex/P/eurex//".
. 2019-04-10 09:29:17.852 Getting real path for '/ucpex/P/eurex//'
> 2019-04-10 09:29:17.852 Type: SSH_FXP_REALPATH, Size: 25, Number: 272
< 2019-04-10 09:29:17.879 Type: SSH_FXP_NAME, Size: 49, Number: 272
. 2019-04-10 09:29:17.880 Real path is '/ucpex/P/eurex'
. 2019-04-10 09:29:17.880 Trying to open directory "/ucpex/P/eurex".
> 2019-04-10 09:29:17.880 Type: SSH_FXP_LSTAT, Size: 23, Number: 519
< 2019-04-10 09:29:17.901 Type: SSH_FXP_ATTRS, Size: 37, Number: 519
. 2019-04-10 09:29:17.901 Getting current directory name.
< 2019-04-10 09:29:17.901 Script: /ucpex/P/eurex
> 2019-04-10 09:29:17.902 Script: get *XML.ZIP D:\BATCHES\TEMP_FILES
. 2019-04-10 09:29:17.902 Listing directory "/ucpex/P/eurex".
> 2019-04-10 09:29:17.902 Type: SSH_FXP_OPENDIR, Size: 23, Number: 779
< 2019-04-10 09:29:17.923 Type: SSH_FXP_HANDLE, Size: 13, Number: 779
> 2019-04-10 09:29:17.923 Type: SSH_FXP_READDIR, Size: 13, Number: 1036
< 2019-04-10 09:29:18.163 Type: SSH_FXP_NAME, Size: 2559, Number: 1036
> 2019-04-10 09:29:18.163 Type: SSH_FXP_READDIR, Size: 13, Number: 1292
< 2019-04-10 09:29:18.180 Type: SSH_FXP_STATUS, Size: 28, Number: 1292
< 2019-04-10 09:29:18.180 Status code: 1
> 2019-04-10 09:29:18.180 Type: SSH_FXP_CLOSE, Size: 13, Number: 1540
...