944,103 Members | Top Members by Rank

Ad:
Jul 11th, 2007
0

Transfer files from ftp1 to ftp2

Expand Post »
I have written a shell script for transfering files from ftp1 to ftp2.
In ftp1 there can be any number of directories,For eg
under sourdedir (mentioned below)there can be any number of directories

eg /opt/lampp/htdocs/scrap/test1/
under test1
1.7505-----1.zip
2.2505------2.zip


In each of the subdirectories there wilI have written a shell script for transfering files from ftp1 to ftp2.
In ftp1 there can be any number of directories,For eg
under sourdedir (mentioned below)there can be any number of directories

eg /opt/lampp/htdocs/scrap/test1/
under test1
1.7505-----1.zip
2.2505------2.zip


In each of the subdirectories there will be a zipped file, I need to put all the zipped files from ftp1 to ftp2(destdir---20070620)


The following file is present in ftp2

The following is the code(downloadfile.sh) which doesnot work.
It gives me invalid command error

ftphost=ftp1(ip)
user=khgkhkghkg
pass=jhgjfjgfgkfjg


# Directory from where you want to pick up the files created on the local system
sourcedir=/opt/lampp/htdocs/scrap/test1/



#Directory where you want the files to be placed on remote system
destdir=/opt/lampp/htdocs/scrap/web/eco-1.3.11/public_html/seo/merchantfiles/20070620

#Switch to Source Dir on Host
cd $destdir

#Name of the file


#Perform Ftp Transfer
ftp -nv << EOF
open $ftphost
user $user $pass
binary
cd $sourcedir
for i in `$sourcedir`
do
prompt
get $i
mput *.*
done

quit
EOF
exit


l be a zipped file, I need to put all the zipped files from ftp1 to ftp2(destdir---20070620)


The following file is present in ftp2

The following is the code(downloadfile.sh) which doesnot work.
It gives me invalid command error

ftphost=ftp1(ip)
user=khgkhkghkg
pass=jhgjfjgfgkfjg


# Directory from where you want to pick up the files created on the local system
sourcedir=/opt/lampp/htdocs/scrap/test1/



#Directory where you want the files to be placed on remote system
destdir=/opt/lampp/htdocs/scrap/web/eco-1.3.11/public_html/seo/merchantfiles/20070620

#Switch to Source Dir on Host
cd $destdir

#Name of the file


#Perform Ftp Transfer
ftp -nv << EOF
open $ftphost
user $user $pass
binary
cd $sourcedir
for i in `$sourcedir`
do
prompt
get $i
mput *.*
done

quit
EOF
exit


Pls can u check and post me the reply as early as possible
Last edited by abc12345; Jul 11th, 2007 at 2:38 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
abc12345 is offline Offline
1 posts
since Jul 2007
Jul 11th, 2007
0

Re: Transfer files from ftp1 to ftp2

and why did you send me personal message? I'm not into shell scripts if you check my profile!
Also how many other people got the message from you too?
Please do not miss use members list in future. Post your question and if anybody know answer they will answer it.
Last edited by peter_budo; Jul 11th, 2007 at 7:48 am.
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
peter_budo is offline Offline
6,659 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: use of mail in MKS
Next Thread in Shell Scripting Forum Timeline: script not working in RedHat Linux.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC