How to Transfer a LIST of FILES?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to Transfer a LIST of FILES?
# 1  
Old 12-09-2012
Error How to Transfer a LIST of FILES?

Hallo guys,
I am new to Linux, I like to transfer multiple files from server A to server B. Source files URLs (from server A) are in a file called "list.txt"
Eg. in list.txt (these links are selective URLs, not all the files in a directory)
which i need to transfer the files from the URL location to Server B. Kindly, help me in detail. Thanks in advance...Smilie

Last edited by vbe; 12-09-2012 at 07:02 AM.. Reason: removing autolinks
# 2  
Old 12-09-2012
Can be done with e.g. ftp, scp, depending on what your local setup(s) looks like. Search these forums for applications of the e.g. scp command, and scripting for remote hosts.
BTW, the syntax would need to be
Code:
user@host:var/www/files/file1.txt
         ^--- here be colon

# 3  
Old 12-09-2012
Error

Ya, i missed : (colon), i know using scp command for bulk transfer from Server A to Server B, my problem is that there is a huge directory containing lots of files in Source directory say Server A, i have selected the links of those missing files in a text file and want to transfer the files from the file list to server B (Destination)..
Thanks for your reply Smilie
# 4  
Old 12-09-2012
Assuming you have ssh-keys setup for password-less login between server A and server B you can use SFTP by creating batch files with the list of files to transfer:-
Code:
for file in /var/www/files/file1.txt /var/www/files/file1f.txt /var/www/files/file2g.txt
do
   awk ' { 
    print "put " $0; 
   }' $file > sftp_batch.cntrl            # creating batch file.
   sftp -b sftp_batch.cntrl user@server_B # transferring using batch file
done

# 5  
Old 12-11-2012
Assume all folders on remote server are exist already. Otherwise try second one.
Code:
while read line
do
  file=${line##*:}
  filename=${file##*/}
  folder=${file%/*}
  echo scp $folder/$filename $line
done< list.txt

scp /var/www/files/file1.txt user@host:/var/www/files/file1.txt
scp /var/www/files/file1f.txt user@host:/var/www/files/file1f.txt
scp /var/www/files/file2g.txt user@host:/var/www/files/file2g.txt

confirm this script is correct, then remove echo and run it again.

If not sure the folder is exist on remove server:

Code:
while read line
do
  file=${line##*:}
  filename=${file##*/}
  folder=${file%/*}
  host=${str%:*}
  echo ssh $host mkdir -p $folder
  echo scp $folder/$filename $line
done< list.txt

# 6  
Old 12-12-2012
For a long list of files rdcwayx's proposal will log in remotely again and again, definitely not the most efficient way to do the task. Using list.txt to create a "batch control" file can be done with either scp or sftp...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Not able to transfer files using between server A and B

Hi All, I have generated public and private pair to avoid to enter password manually while sending files through sftp. But still I am facing issues and every-time prompt asking enter password. Below are steps I fallowed to make ssh connection between two servers. 1. Generated public and... (5 Replies)
Discussion started by: renukeswar
5 Replies

2. Linux

How to transfer files...

Hi guys, ok so, how do you go about networking between Windows and Linux so that I can transfer files between each other? (5 Replies)
Discussion started by: billcrosby
5 Replies

3. Shell Programming and Scripting

Script to transfer files

Hi, I am new to scripting, I need to write a script to transfer .TXT files from Server A (ftp) to Server B. Once the files in server B i need to transfer it to server C (sftp). (not transfer of files directly from server A to Server C ) Thanks! Regards Sendhil ---------- Post updated at... (3 Replies)
Discussion started by: Sendhil.Kumaran
3 Replies

4. HP-UX

Transfer Files from Windows to HP-UX

I need to transfer files from Windows to Hp-UX box with out any software(Filezilla ...., Fsecure file transfer) Is it possible to transfer using command prompt ? (6 Replies)
Discussion started by: girija
6 Replies

5. Shell Programming and Scripting

Help needed to transfer list of files to FTP server, to different folders

Hello Unix Gurus, Help required from you. My requirement is something like this I want to create a concurrenct program in Oracle Applications using shell script to transfer files from Apps Server to destination FTP server. I have created custom program, where I will extract all the... (4 Replies)
Discussion started by: amazon
4 Replies

6. Shell Programming and Scripting

Transfer Of Files

How to transfer the files in windows server to the unix server by using the unix or ftp commands? (1 Reply)
Discussion started by: vinay123
1 Replies

7. UNIX for Dummies Questions & Answers

How to transfer files

please help me to transfer files from one server to another one i am having problem in it thanks (1 Reply)
Discussion started by: pankaj001np
1 Replies

8. UNIX for Dummies Questions & Answers

How to transfer files

(0 Replies)
Discussion started by: spoonman
0 Replies

9. UNIX for Advanced & Expert Users

How do i transfer files

Im trying to transfers a file from one unix server to another , make some changes and then send it back to the original server. All this using modems. I've been using "cu" and i can "get" the file but i can't "put" it. Besides I need to do this using a shell script. I can write a script to get... (4 Replies)
Discussion started by: phsoft
4 Replies
Login or Register to Ask a Question