Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy contents of a file script 1

Status
Not open for further replies.

UsRb

IS-IT--Management
Mar 19, 2007
48
HR
Hi 2 everyone

I am trying to make a script that goes like this:

ls directory >> 1.log
ls directory1 >> 2.log
diff -e 1.log 2.log >3.log

Now, the content of 3.log is a list of files
I want that files to copy from one directory to another. How?
Thanx in advance....
 
A starting point:
while read f
do cp "/path/to/srcdir/$f" "/path/to/destdir/$f"
done < /path/to/listoffiles

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanx men, that was very helpful!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top