How to Know if the ftp sent file sent OK

I send files by ftp using ksh script . The real Proplem is How to Know if the sent file sent OK or Not (As rcp command I was check ($?) to know the sent file correctly sent or not)?

Must use ftp command to test -e.g. ls
 

I realy used this solution inside my script ; But How I decide the result (Found OR NotFound )To report in simply and readable Form to enduser .To invoke this, the following was my way :
1- call ftp scrpt from a parent scrpt
2- redirect ALL ftp output to a file
3- put the file
4- run "ls" inside ftp & echo a messge conaining constant expr. to the output file
5- after ftp scrpt ends , the process reback to parent scrpt then I grep a line witch includes both constant "IS" and the sent file name because I noticed that when ls found file it prints the file name .
but I want more professional way .
 

clear

echo "enter date ..\c" ; read dte ; export dte
if [ $dte ] ; then
echo ".. SENDING ...\c"
# folowing line calls ftp scrpt i named it SEND
/home2/flexuser/report/send >/home2/flexuser/report/send.log 2>&1
echo "Branches NOT sent "
echo "=================="
grep IS /home2/flexuser/report/send.log |grep -v txt|cut -f8 -d" "
echo ""
echo "Branches didnot respond "
echo "=================="
grep respond /home2/flexuser/report/send.log
echo ""
echo "Branches sent "
echo "=================="
grep IS /home2/flexuser/report/send.log |grep txt |cut -f14 -d" "
else
echo "input is not proper "
exit 1
fi
echo " Press Enter To exit ..\c"
read xx
 

###FTP SEND SCRIPT ###############
for host in `cat /home2/flexuser/.netrc |cut -f2 -d" "`
do
brn=`grep $host /home2/flexuser/.netrc |cut -f8 -d " "`

ping $host 1 >/dev/null
case $? in
0)echo "\n Now you are sending $host";
ftp $host <<-ENDFTP
lcd /home2/flexuser/source
cd ATM_REP
put br_rp$dte.$brn br_rp$dte.$brn.txt
ls br_rp$dte.$brn.txt
!echo " IS The file br_rp$dte.$brn for $host Found ?\c"
bye
ENDFTP
;;
echo " No respond from $host" ;;" >> /home2/flexuser/report/send_rep/noconect ;
esac
done

Have a Unix Problem
Do you have a UNIX Question?

Books About Unix
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Unix Home: Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.