Ftp a directory to another server from the local server what is the command | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

Ftp a directory to another server from the local server what is the command

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-12-2013
PMoore PMoore is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 23 January 2014, 2:47 PM EST
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Ftp a directory to another server from the local server what is the command

ftp a directory to another server from the local server what is the command
Sponsored Links
    #2  
Old 12-13-2013
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 26 August 2014, 10:02 PM EDT
Location: NM
Posts: 10,180
Thanks: 273
Thanked 785 Times in 734 Posts
Does the directory already exist on the remote box?

Can you use ssh to connect or do you have to use ftp?

This is the best and basically only choice, which preserves file permissions and ownership, command from the source machine:


Code:
tar cpf - /some/important/directory | ssh user@destination-machine "tar xpf - -C /some/newdirectory/"

There is no ftp equivalent. And if you cannot log onto the remote box you will have to manually create the directory using the ftp command mkdir, then copy each file over:

Code:
cd /path/to/source-directory
HOST='remote-box'
USER='you'
PASSWD='yourpw'
FILE='file.txt'

ftp $HOST <<-EOF
user $USER
$PASSWD
cd /path/to/
mkdir newdirectory
quit
EOF

for fname in *
do

ftp $HOST <<-EOF
user $USER
$PASSWD
cd /path/to/newdirectory
put $fname
quit
EOF

done

Last edited by jim mcnamara; 12-13-2013 at 06:44 AM..
The Following User Says Thank You to jim mcnamara For This Useful Post:
PMoore (12-13-2013)
Sponsored Links
    #3  
Old 12-13-2013
PMoore PMoore is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 23 January 2014, 2:47 PM EST
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Thanks...i am new to Unix....I will try the command
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
FTP files from different directory from remote server to one directory in local dassv Shell Programming and Scripting 3 12-16-2011 10:01 AM
Do I need to configure my local windows to FTP files from local windows to a UNIX AIX server? rajsharma AIX 1 08-19-2010 01:22 PM
preserving the timestamp of a file when copied from remote server to local server using ftp arunkumarmc Shell Programming and Scripting 5 05-14-2010 05:18 AM
Dowloading a File from FTP Server to a local Server where User Id's are different ranjith_taurean Shell Programming and Scripting 1 02-22-2007 06:47 AM
FTP multiple files from remote server to local server berlin_germany Shell Programming and Scripting 2 12-20-2006 02:24 AM



All times are GMT -4. The time now is 02:58 PM.