Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-12-2008, 03:04 AM   #1
LQ Newbie
Registered: Feb 2008
Posts: 2

Rep: Reputation: 0
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

Old 02-12-2008, 03:18 AM   #2
Registered: Aug 2006
Distribution: Ubuntu, CentOS
Posts: 31

Rep: Reputation: 15
Hi coral_km

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


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.
Old 02-12-2008, 05:50 AM   #3
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I think OP wanted to read from the list of files and transfer those files to another system.
If "list" is the text file containing the files, and "dest" is the path to the destination,
for i in `cat list`; do cp  $i dest; done
Old 02-13-2008, 10:23 PM   #4
LQ Newbie
Registered: Feb 2008
Posts: 2

Original Poster
Rep: Reputation: 0
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...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Very simple shell script - move files to different directories beley Programming 7 11-02-2006 05:24 AM
shell script for changing a txt file content Flobsi Linux - Newbie 3 10-06-2006 03:10 AM
shell script for changig txt-file content Flobsi Programming 1 10-05-2006 05:46 PM
making a script that will move a file or files in a trash folder Paxmaster Programming 5 12-12-2004 06:00 PM
bash:output file names from shell script to vi sickboy Linux - Newbie 6 10-14-2004 03:40 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:11 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration