Checking the file in remote server using SFTP

Hello, I would appreciate if any one can help me on this.

The below script start running at 12:30AM. Every 5 min, i go and check the remote site. If i see filewatch.txt over there, then i need to call another shell script and load the data into database. If i don't see that file, then i have to loop for one hour(sleep 5 every iteration) and keep check the filewatch.txt. If i don't find at 1.00AM, then send email to entire team.

Here is the below script.

while true
do
sftp dmchain@xyz.com
cd /hqspool/scc02505/DATA/B1P/outbound/datafiles/report
if [ -f filewatch.txt ]
then
echo "file found"
else
echo "file  not found"
fi
exit
done

This script is not working... It is hanging.. But i am able to connect manually and sftp the files...

Here is the output of the above script...

uixpad01(orcl) /odsimp/apps/xyz
==> sh gt.sh
Connecting to xyz.com...

Am i missing anything here... Please advise...

Once you're logged in just do:

sftp myname@myftpserver
cd mydir
ls ${FILENAME}
bye

If it's there it will list it.

Thank you. My problem solved...[COLOR="\#738fbf"]