Abort script if local file exists
Hi I need to check if a file exists on the remote server and abort the script if NOT. I am using option "failonnomatch on" which works fine for the remote directory, but I also need to abort the script if the file DOES exist in the local directory. I tried option "failonnomatch off" for the local file but it does not appear to work that way, I was hoping it would just be the opposite to 'on' if the condition was met. Is there a simple option to abort the script if a local file already exists i.e. local file (C:\ssis\triggers\*.TRG) simple example of what I have so far (very basic) below.
This Works
----------------------------------------------------
open sftp://sftptcu:**************@10.253.***.**
cd /data/udaftp/cl-universe/u3/TCU/DEX.TRIGGER
option failonnomatch on
ls /data/udaftp/cl-universe/u3/TCU/DEX.TRIGGER/*.TRG
This Doesn't
-----------------------------------------------------
lcd C:\SSIS\AML\SourceFiles\
option failonnomatch off
lls C:\SSIS\AML\SourceFiles\*.TRG
-----------------------------------------------------
Thanks Gazz
This Works
----------------------------------------------------
open sftp://sftptcu:**************@10.253.***.**
cd /data/udaftp/cl-universe/u3/TCU/DEX.TRIGGER
option failonnomatch on
ls /data/udaftp/cl-universe/u3/TCU/DEX.TRIGGER/*.TRG
This Doesn't
-----------------------------------------------------
lcd C:\SSIS\AML\SourceFiles\
option failonnomatch off
lls C:\SSIS\AML\SourceFiles\*.TRG
-----------------------------------------------------
Thanks Gazz