Hello,
my task is to connect to an SFTP site, change local/external directory, put all files, change directories again, put all files etc.
Everything works fine, unless the source directory is empty, I'll get the message
"No files matching ‘*’ found." and the script halts with a WinSCP prompt, so it won't continue with the next command.
I have set the
batch on
option.
Here's is my bat-file:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="E:\xc_prod\FTP\wam_ftp\Kunde.txt" /loglevel=1 /ini=nul ^
/command ^
"open sftp://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx^
"option batch on" ^
"echo ====================desadv====================" ^
"lcd E:\xc_prod\FTP\wam_ftp\in\Kunde\desadv\" ^
"cd ../DELIVIN" ^
"put -delete DELIVIN* ./ " ^
"echo ====================invoice====================" ^
"lcd E:\xc_prod\FTP\wam_ftp\in\Kunde\invoice\" ^
"cd ../INVIN" ^
"put -delete INVIN* ./ " ^
"echo ====================ordrsp====================" ^
"lcd E:\xc_prod\FTP\wam_ftp\in\Kunde\ordrsp\" ^
"cd ../ORDCONFIN" ^
"put -delete ORD* ./ " ^
"echo ====================orders====================" ^
"lcd E:\xc_prod\Source\Application\incoming\" ^
"cd ORDOUT" ^
"get -delete ORDOUT* ./ " ^
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
exit /b %WINSCP_RESULT%