1)In this script mput command is not working( not transfering multiple files, it is able to send single file)
2)here is the script to automate the ftp process .
3)for transfering files from one machine to other machine using ftp
can anyone can give me the solution in this issue
Script is given below
Hey there, I had the same problem trying to MPUT multiple files from our unix server to novell server. MPUT simply wouldn't work as the novell server needed to know the remote filename as well as the local filename.
To get around this I created a script that gets a directory listing of a directory (containing files i want to ftp) the script then loops through the filenames and ftp's them via PUT.
DATE=$(date +%d%m%y)
LIST=/tmp/ftplist
FILENAME=""
COUNT=1
rm $LIST
echo "finish" >> $LIST
#Our local directory containing files to FTP
cd /prg/tocc/prd/usr/user1/ftp
#Get a directory listing & output to file
ls -lrt | cut -c59-78 >> $LIST
while [ 1 ]
do
tail -$COUNT $LIST | head -1 | read FILENAME
if [[ $FILENAME = "finish" ]];
then
echo "Finished"
exit 0
else
cd /prg/tocc/prd/usr/user1/ftp
ftp -n -v <<-EOF
open myftpserver
user user1 passw0rd
mkdir /data/public/$DATE
put $FILENAME /data/public/$DATE/$FILENAME
bye
EOF
COUNT=$(expr $COUNT + 1)
fi
done
You may need to change the cut value if you have longer filenames.
If have many files in that directory and only want to send the sample*.dat files, simply change the line from
#Get a directory listing & output to file
ls -lrt | cut -c59-78 >> $LIST
to
#Get a directory listing & output to file
ls -lrt sample*.dat | cut -c59-78 >> $LIST