FTP the file from other server to local server

FTP the file from other server to local server

#!/bin/bash
HOST='ftp.askhareesh.com' #HostName
USER='AskHareesh' #UserName
PASSWD='@5kh@r335h' #Password
DIREC='/out/tmp/' #Directory of the file to save
FILE='AHSalesOrders' #File Name starts with
echo "Host : $HOST"
echo "User Name : $USER"
echo "Directory : $DIREC"
echo "File Name starts with : $FILE"
echo "Start of the Script"
cd $DIREC
#Start of FTP script
ftp -n -v $HOST << EOT
ascii
user $USER $PASSWD
prompt
cd OUT
mget $FILE*.csv
bye
EOT
#Loop for renaming/archiving the files
for FNAME in $FILE*.csv
do
echo "File Name : $FNAME"
ftp -n -v $HOST << EndLOOP
ascii
user $USER $PASSWD
prompt
cd OUT
rename $FNAME $FNAME.done.$(date "+%m%d%Y%H%M")
bye
EndLOOP
done
echo "End of the Script"
*/

No comments:

Post a Comment