Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


script for checking if file exists is not working

so the situation is to check that a file exists first, if it does then continue on to the next steps of the ssis package. if the file does not exist then exit and stop. i used the script from and when i run it i get an error message...
Script: set REMOTE_PATH=/Home/blahblahblah/CustomContractImport/Import/Importcontract.xlsx

Script: Unknown command 'set'.
Script: Failed

is this set command not right? is there something that was not in the original script that was not correct? this seems like a simple script even for a noob like me but apparently it is not. :( can someone help me?
the scriopt is...
# Automatically abort script on errors

option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect to SFTP server using a password
open s -hostkey="ssh-rsa 2048 fc:0f:92:5d:98:d4:77:65:2a:eb:a2:fa:0d:27:0a:7f"
# Upload file

echo off
set REMOTE_PATH=/Home/blahblahblah/CustomContractImport/Import/Importcontract.xlsx /command ^
    "open mysession" ^
    "stat %REMOTE_PATH%" ^
if %ERRORLEVEL% neq 0 goto error
echo File %REMOTE_PATH% exists

exit /b 0
echo Error or file %REMOTE_PATH% not exists
exit /b 1

# Disconnect

Re: Check if file exists before download

i use get command to download a file from a server...But everytime the file doesn't exists i get an error message. So i want to firstly check if the file exists and then use get command to download it!

Re: Check if file exists before download

OK, I've misunderstood the question.

Though it's still confusing. Why are you trying to check a local file before calling WinSCP with upload.txt script, if you are going to download a file?

Re: Check if file exists before download

Sorry i forgot to add my UserName before

Re: Check if file exists before download

I don't want to use .NET assembly. I have mentioned that in question! I want to use a simple bat file.

Check if file exists before download

i want to check if a file exists before download it without using .NET assembly. I try this:
if exist c:\upload\test.txt /script=upload.txt
from your documentation at
but it returns an error that command if is not recognized. Could you help me plz?
Thank you!