ftp a files from a folder

Hi

Can anyone give me a shell script to ftp all the files in a folder to a another machine .And if the ftp is sucees i want to move the files to the same to another folder in the same client m/c

look at the ftp commands "mget" and "mput".

Hi, please correct me if there is any wrong in this script. Hope the files which are intended to be transfered are ascii files.

#!/bin/sh
result=`/usr/bin/ftp -dvin << EOF
open "$1"   # IP address (or) hostname
user <username> <passwd>
lcd /home/foo/temp
cd /home/foo/cfiles
ascii
hash
bell
mput *.c
close
bye
EOF`

value=`echo "$result" | grep "226 Transfer complete" | wc -l`

[ "${value}" -ge 1 ] && { echo "$value files transferred"; exit 0; }
echo "FTP Failure"; exit 1

you can use 'on' command to move the files which are transfered to another location in that remote client. See man page to get more details about 'on' command.