|
|
Copy a file to all subfolders of a folder with one command
The find -exec command is a very useful one for more then just this. It's also a generic Unix tip, not just OS/X. The most common usage tends to be removing files. For example, if you have a set of directories that are in Subversion and you need to get rid of the .svn directories scattered throughout the directory structure:
Copy a file to all subfolders of a folder with one command
When I did it, from Terminal, I didn't have to escape the brackets -- it worked as shown (bash, 10.5 and 10.6).
Copy a file to all subfolders of a folder with one command
For files, I skip exec, which seems messy unless necessary, and use:
find -name blah -print -delete I also usually prefer to use xargs when possible, ie. find . -type d -print0 | xargs -0 -n1 cp php.ini(-n1 tells xargs to execute the command once for each entry, rather than simply appending each to the end of the command) Or: find -name .svn -print0 | xargs -0 rm -rfAll these "rm -rf" commands are going to give me nightmares. --- i am jack's amusing sig file Edited on Mar 02, '10 11:07:18AM by fracai
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.31 seconds |
|