LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Recursive copying... (https://www.linuxquestions.org/questions/linux-newbie-8/recursive-copying-806086/)

pantera975 05-05-2010 09:08 AM

Recursive copying...
 
Does anyone know of a way I can recursively copy 1 file into multiple directories? I have an index.html file that needs to be copied to every folder inside my /var/www/html directory. These directories can change in the future when people add new folders and I just want a cron job that runs daily and checks for new folders in /var/www/html and if it finds one, copy index.html to it.

pixellany 05-05-2010 09:11 AM

I would use "find" with the "-exec" option

pantera975 05-05-2010 09:54 AM

Thanks alot! I never knew about "-exec". I got it pretty quick using..

find . -type d -exec cp index.php {} \;

pixellany 05-05-2010 11:41 AM

I have just given you your first "thank you"---simply for taking the hint and running with it. You have no idea how rare this is..


All times are GMT -5. The time now is 11:09 PM.