In an SSIS package using the execute process task I am executing a script file which is WinSCP scripting to connect to an FTP site via WinSCP.
I am able to use the basics like get, put, open commands in WinSCP.
But there is a scenario where I want to check if a file exist on an FTP site and if it does I pull the file else I pull a different file WinSCP.
However it seems that the moment I put if it just fails the script like it cannot read that syntax.
Does if statement not exist for WinSCP script files?
I was using this link for reference in building the if statement: https://winscp.net/eng/docs/script_checking_file_existence#scripting
This is the WinSCP script file code I have.
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open FTP
# Remote FTP Folder
cd SSISFTP
# get file attributes
stat FILEONE.txt
# conditional statement
if %ERRORLEVEL% neq 0 goto error
# Get FILEONE File
get FILEONE.txt
# Disconnect
close
# Exit WinSCP
exit /b 0
:error
get FILETWO.txt
# Disconnect
close
# Exit WinSCP
exit /b 1`