The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Pull a file from a remote server through a shell script sashankkrk UNIX for Dummies Questions & Answers 2 04-23-2008 01:13 PM
Script runs fine on UNIX Server...Not through MSK Tool kit on Windows Server madhunk UNIX for Dummies Questions & Answers 5 01-31-2008 09:30 AM
Shell Script to ftp from windows server shilpa.rajput Shell Programming and Scripting 8 11-06-2007 08:52 PM
Move root disk to new server VirginiaSA SUN Solaris 18 05-20-2005 02:48 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-26-2005
Registered User
 

Join Date: Sep 2005
Posts: 74
how to move a file from one server to another server using FTP in shell script?

I have a file --> file1.txt
i need to copy this file to another server using FTP....the 2 servers are server1 and server2..may i know how to write a script that can do this?

thanks in advance! Im a newbie to this...
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-26-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,662
Did you have a look at the forums' FAQ ?

Here is a link - Automate FTP / Scripting FTP Transfers
Reply With Quote
  #3 (permalink)  
Old 10-26-2005
Registered User
 

Join Date: Sep 2005
Posts: 74
ok thanks! however, now i need to put all the text files in a directory over to the other server. The directories contains other files beside text files. i only need to put text files. I now only manage to put a single text file to the other server. I also have error in my coding.....

Heres my coding:
set FILENAME = /local/filename.log

ftp -v -n "myipadd" << cmd
user "user" "passwd"
cd /remote/FTP
lcd /local/ ssh_install

ls -1 *.txt $local_path > $FILENAME

put $FILENAME
quit
cmd
Reply With Quote
  #4 (permalink)  
Old 10-26-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,662
You can use mput *.txt

Before doing that, you need to turn off the interactive mode of FTP. Just use prompt before doing the mput.
Reply With Quote
  #5 (permalink)  
Old 10-26-2005
Registered User
 

Join Date: Sep 2005
Posts: 74
Thanks vino! the script is working fine now :P
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0