The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Copying multiple folders to local machine (don't know folder names) leenyburger UNIX for Dummies Questions & Answers 5 06-12-2008 04:38 AM
moving directories to new directories on multiple servers mackdaddy07 Shell Programming and Scripting 0 04-06-2007 08:30 AM
Copying multiple directories at the same time using Unix JPigford UNIX for Dummies Questions & Answers 9 01-17-2005 02:16 PM
Copying to multiple floppies? cstovall UNIX for Dummies Questions & Answers 1 04-20-2004 08:54 AM
Find wildcard .shtml files in wildcard directories and removing them- How's it done? Neko UNIX for Dummies Questions & Answers 1 06-27-2001 06:06 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-21-2007
Registered User
 

Join Date: Apr 2007
Posts: 11
copying to multiple directories using wildcard

Can we copy a file to multiple directories using a single command line , i tried with * didnt work for me

cp /tmp/a.kool /tmp/folder/*/keys/


I am tryn to copy a.kool file to all keys folder in /tmp folder. is something i am missing ?
Reply With Quote
Forum Sponsor
  #2  
Old 05-22-2007
Registered User
 

Join Date: Jan 2005
Posts: 212
This will copy a.kool and everything from /tmp/folder/* to /keys/.

You can use looping.

Make a list of folders where you want to copy in a text file.

for a in `cat list.txt`; do copy a.kool $a/; done;
Reply With Quote
  #3  
Old 05-22-2007
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Quote:
Originally Posted by logic0
Can we copy a file to multiple directories using a single command line , i tried with * didnt work for me

cp /tmp/a.kool /tmp/folder/*/keys/


I am tryn to copy a.kool file to all keys folder in /tmp folder. is something i am missing ?
find /tmp/folder/ -type d -name keys -exec cp /tmp/a.kool {}\;

but be careful
Reply With Quote
  #4  
Old 05-22-2007
praveenkumar_l's Avatar
Registered User
 

Join Date: May 2007
Posts: 36
Try this

find . -path "/tmp/folder/*/keys/" -type d -exec cp /tmp/a.kool {} \;

may be similar to previous post
Reply With Quote
  #5  
Old 05-22-2007
praveenkumar_l's Avatar
Registered User
 

Join Date: May 2007
Posts: 36
sorry small correction

find /tmp/ -path "/tmp/folder/*/keys/" -type d -exec cp /tmp/a.kool {} \;
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:13 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0