The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
copying .profile files to a new server (SCO) sighbrrguy UNIX for Dummies Questions & Answers 2 12-05-2007 03:02 PM
copying files from one location to another based on a list rebornhonest UNIX for Dummies Questions & Answers 4 11-30-2007 03:32 PM
Copying files from laptop to remote server using SSH patwa UNIX for Dummies Questions & Answers 3 11-22-2006 04:14 AM
copying files to a remote aix server using tar! system-admin AIX 2 11-17-2006 03:30 PM
Copying files between 2 Unix server Docboyeee UNIX for Advanced & Expert Users 9 10-20-2003 02:54 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-23-2007
Sepia Sepia is offline
Registered User
  
 

Join Date: Apr 2007
Location: England
Posts: 49
Copying a list of files from one 'server' to another?

I have two servers. I would like to copy some files from one directory on server A into the same directory on server B.

Its not all the files in in the directory, just some of them.

Is there a way to make a file list in a txt file and then somehow copy all the files in that list in one go to the other server?

Thanks.
  #2 (permalink)  
Old 04-23-2007
Percy Percy is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 14
files.txt contains a list of every file you want to copy.


Code:
for line in files.txt
do
    cp $line server:$line
done
You get the gist...

...oh - unless its scp or something and then you'd end up having to type in your password for each line
  #3 (permalink)  
Old 04-23-2007
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,310
Quote:
Originally Posted by Sepia
I have two servers. I would like to copy some files from one directory on server A into the same directory on server B.

Its not all the files in in the directory, just some of them.

Is there a way to make a file list in a txt file and then somehow copy all the files in that list in one go to the other server?

What shell are you using? If it's bash or ksh put the list of files in an array, e.g.:

Code:
filelist=( "file 1" "file 2" etc. )

scp "${filelist[@]}" remote.server:path
Or use the list directly on the command line:

Code:
scp "file 1" "file 2" etc. remote.server:path
  #4 (permalink)  
Old 09-10-2008
awolbach awolbach is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 1
use symlinks

Quote:
Originally Posted by cfajohnson View Post

What shell are you using? If it's bash or ksh put the list of files in an array, e.g.:

Code:
filelist=( "file 1" "file 2" etc. )

scp "${filelist[@]}" remote.server:path
Or use the list directly on the command line:

Code:
scp "file 1" "file 2" etc. remote.server:path
In these situations you run the risk of exhausting the maximum length of arguments to a process. I ran into this problem today when I needed to randomly divide two massive sets of files evenly between two servers. Create a new directory for each server and fill it with symlinks to the files you wish to copy to that server. If it's a lot of files, automate it by creating a script:

Code:
cat file_list | sed 's/^.*$/ln -s & /' > symlink_script.sh
Execute the script inside of your new directory. Then, just copy that directory over to the target server, and scp will follow the symlinks.
  #5 (permalink)  
Old 05-04-2009
KiranKumarKarre KiranKumarKarre is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 62
File server from one server to another server

Can anyone give me complete discription of following statement as am new to Unix.

scp "file 1" "file 2" etc. remote.serverath

I want to transfer file e.g test.sh to C drive in 102.19.23.122 ,

I am tryig like
scp test.sh 102.19.23.122:C

but its not working ,
  #6 (permalink)  
Old 05-04-2009
devtakh devtakh is offline
Registered User
  
 

Join Date: Oct 2007
Location: Bangalore
Posts: 514
Quote:
Originally Posted by KiranKumarKarre View Post
Can anyone give me complete discription of following statement as am new to Unix.

scp "file 1" "file 2" etc. remote.serverath

I want to transfer file e.g test.sh to C drive in 102.19.23.122 ,

I am tryig like
scp test.sh 102.19.23.122:C

but its not working ,
For this copy, it will be easier for you to just do a ftp from the DOS command prompt

Code:
open DOS 
cd c:
ftp unixbox
user
paswword
cd /dir  [ directory where your tesh.sh is present]
get test.sh
bye
cheers,
Devaraj Takhellambam
  #7 (permalink)  
Old 05-05-2009
Percy Percy is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 14
Make sure you're getting your syntax correct.

scp /file/location/of/test.sh 102.19.23.122@:/file/location/to/copy/to

And also - make sure you actually can reach 102.19.23.122
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 12:38 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0