PDA

View Full Version : What is the most simple Linux commands to copy a file/s into all subdirectories



Fli
09-06-2017, 03:49 PM
Hello,

when i have index.php file in /path/files/
and want to copy and replace without asking it into all subdirectories of the /path/files/

(/path/files/subdir1 , /path/files/subdir2 .. there is around 15 more dirs)

what are most simple commands?

i was trying rsync and "cp -p -f index.php */"
but no lucky.

What worked is this complicate command:
for dir in $(ls -A1 /path/files|grep -Ev "\./");do cp -p -f index.php $dir;done