![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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 ? |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
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; |
|
#3
|
||||
|
||||
|
Quote:
but be careful |
|
#4
|
||||
|
||||
|
Try this
find . -path "/tmp/folder/*/keys/" -type d -exec cp /tmp/a.kool {} \; may be similar to previous post |
|
#5
|
||||
|
||||
|
sorry small correction
find /tmp/ -path "/tmp/folder/*/keys/" -type d -exec cp /tmp/a.kool {} \; |
||||
| Google The UNIX and Linux Forums |