- Copy a file to all subfolders of a folder with one command
-
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 ... view original article
Tue, 02 Mar 2010 16:30:00 +0100 - more MacOSXHints.com articles
-
- related articles found at MacOSXHints.com
- 10.4: A simple way to copy the path to a file or folder Fri, 19 Oct 2007 16:30:00 +0200
- One way to 'link' to files, folders, etc. in iWork documents Thu, 17 Apr 2008 16:30:02 +0200
- Sort files into date-labeled subfolders using Perl Mon, 25 Feb 2008 16:30:04 +0100