Get the count of files transmitted

Hi All,

My requirement is to transfer a group of files from one server to another server and check the no. of files transmitted. If the no. of files exceeds 100 then i have to stop file transmission.

I'm using ftp and put command to transfer files.Please guide me to get the count and stop the process.

Thanks.

Something like this (not the real code)

for i in `ls`
do
  #Your FTP parts
  j++
  if ["$j" >= "100" ]; then 
      exit
  fi
done