LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 02-12-2008, 03:04 AM   #1
coral_km
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

thanks,
coral
 
Old 02-12-2008, 03:18 AM   #2
akuma_linux
Member
 
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 -

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

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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
 
Old 02-13-2008, 10:23 PM   #4
coral_km
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...
 
  


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


All times are GMT -5. The time now is 12:04 AM.

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