Over the weekend, I was installing a demo of some web-based help desk software, and this particular package used encrypted PHP files. With my hosting company, I have to place a php.ini file in every directory that contains encrypted files, or the site won't work. This particular package had hundreds of directories, buried in folders and subfolders, and I was dreading the task of copying this one file into each of them.
A tip from my friend James pointed me to the solution, in the form of Smiling Dragon's reply in this thread over on the Unix/Linux forums. Assuming the file exists in the parent directory, then this command does the trick:
find . -type d -exec cp php.ini {}/ \;
This worked perfectly, and incredibly quickly -- at first I thought it had failed, but a quick sample of a deeply-buried folder showed that the file was now in each and every sub-directory on the site. Note that if something goes wrong when you try this, you may create quite a mess to clean up; I tried it first on my local machine, just to be sure it worked. Only then did I run the command on my web server.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100228102548767