i am trying to write a simple winscp script to use it inside a for loop, in a batch file. The loop is :
for /F "tokens=2 delims==" %%s in ('set REMOTE_PATH[') do ("
ECHO CHECKING FOR %%s
winscp.exe /console /script=run01test1 /parameter // %%s
IF %ERRORLEVEL% neq 0 (
ECHO FILE %%s DOES NOT EXIST
CALL:error10 "76" "UNABLE TO LOCATE TARGET FILE %%s "
CALL:ERRORNOTIFYMAIL "UNABLE TO LOCATE TARGET FILE %%s" "FATAL" "CHECK EXISTENCE OF TARGET DIRECTORY" "77"
EXIT /B 10
) ELSE (
ECHO FILE %%s EXISTS
)
ECHO.
)
and the run01test1 winscp script is :
open sftp://xxx:xxx@xx.xx.xx.xx
stat "%1%"
exit
My problem is, that it either doesnt pass the parameter right, or for some reason the return value always returns zero whether the command stat succeeds or not. For the record, the idea is to check if files exist, the files are stored in an array in the style of :
set remote_path[0]
set remote_path[1]...
Can anyone help? Thanks in advance