SFTP check if file exists

I lookifn for a way to SFTP a file based on the presence of a flag file .

The logic is some thing like this in shelling terms

IF [[ ! -s file.DDMM.done ]]; then
download file.DDMM.dat
FI

The above is just the way of interpreting the logic.

Just want to add that i do not have SSh access to the remote server

try this ..

if [ ! -s "file.DDMM.done" ]
then
        ftp -vin >> ftp.log <<!
        open remote_IP
        user $USER $PWD
        cd /path/in/remote/server
        get file.DDMM.dat
        bye
        !
else
        echo "File exists"
fi

i figured out a way to use batch file to check if the done file is there. i find is the file is there using the verbose mode of sftp. downside of using batch is that there will not be any return codes.

Well fo rnow it works . is there a better way ? would love to do it that way ..