I have a SSIS package that executes the WinSCP.exe via execute process task and download the set of files to some common folder location.
Files names are:
Text1.csv
Test2.csv
and so on..
After that I am running another set of Execute process tasks which will use the C:\Windows\System32\cmd.exe
which start copying downloaded files to different respective locations.
Below is my command line arguments to first download the files at some common location:
/log=G:\USER_DATA\USER_USER_SYNC\SFTP_LOG\user_sync_winscp.log /command "open sftp://bisftp:*UFVy2u6jnJ]#hU0Zer5AjvDU4#K3m@stransfer.host.com/ -hostkey=""ssh-rsa 2048 9b:63:5e:c4:26:bb:35:0d:49:e6:74:5e:5a:48:c0:8a""" "cd /DATA" "get -filemask=">=today" Test1.csv Test2.csv G:\USER_DATA\USER_USER_SYNC\Download\" "exit"
Below are my command line arguments to copy the files to different locations:
/C copy /b G:\USER_DATA\USER_USER_SYNC\Download\Test1.csv G:\USER_DATA\USER_USER_SYNC\Testing1
/C copy /b G:\USER_DATA\USER_USER_SYNC\Download\Test1.csv G:\USER_DATA\USER_USER_SYNC\Testing2
I have few questions here.
Since I am using filemask to download the latest updated files only. If first Execute process task run successfully then it will set the exit code returned as '0' and then next Execute process task gets executed to copy the files to different locations. Everything runs fine till this end.
However there can be a case when first execute task is not able to download the files to common folder location. Reasons of failure could be that other party has not put the latest files on SFTP server and due to date mismatch, it was not able to download the files in first place or could be some other network issues as well.
So it throws an exception that like "The process exit code was "1" while the expected was "0"."
due to when my next subsequent execute process task run and it's getting failed as it has nothing to copy or move.
Can we capture the exit code returned to some variable, so that we can use it further in some expression to decide whether to execute another task or not?
Also I am using different execute process task to copy the files. Can we combine separate copy steps into one and use one Execute process task?