LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shell script to move files from one system to another sytem with file names in a txt (https://www.linuxquestions.org/questions/linux-newbie-8/shell-script-to-move-files-from-one-system-to-another-sytem-with-file-names-in-a-txt-620504/)

coral_km 02-12-2008 03:04 AM

shell script to move files from one system to another sytem with file names in a txt
 
Hi frnds,

I would like to write a shell script to move few files from one system to another system whose files names are stored in a text file.....

Please help me in this regard

thanks,
coral

akuma_linux 02-12-2008 03:18 AM

Hi coral_km

I'd try something like this, substituting the correct paths. Save the following in a file and give it execute permission -

Code:

#!/bin/bash

ls -la /path/files/ > /path/files/list.txt
scp /path/files/* user@destination:/path/destination/

This script should create a text file in /path/files/ called list.txt listing of all the files in /path/files/ then copy the entire contents of /path/files/ into /path/destination/ on the other system.

Hope this helps.

pixellany 02-12-2008 05:50 AM

I think OP wanted to read from the list of files and transfer those files to another system.
eg:
If "list" is the text file containing the files, and "dest" is the path to the destination,
Code:

for i in `cat list`; do cp  $i dest; done

coral_km 02-13-2008 10:23 PM

Thanks for ur reply.

But what i actually meant is the txt file contains jus the name of the files which are to be moved from one directory to another... y i stored them in a txt file is bcoz it is huge in number.....

thanks.. waiting for ur reply...


All times are GMT -5. The time now is 03:57 PM.