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)

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

which i need to transfer the files from the URL location to Server B. Kindly, help me in detail. Thanks in advance...:slight_smile:

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

user@host:var/www/files/file1.txt
         ^--- here be colon

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 :confused:

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:-

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 

Assume all folders on remote server are exist already. Otherwise try second one.

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:

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

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...