I want to place 1 file called "test1.html" in 100 different directories of website.
Directory structure is like the following
/home/domain.com/public_html/ (domain.com name are change for every directory so i use * .
File are here: /root/test1.html
I have try it by : cp test1.html /home/*/public_html/
via root account but give me
cp: omitting directory `/home/domain1.com/public_html/'
cp: omitting directory `/home/domain2.com/public_html/'
and so on.
how to place the one file in all domains directory?
it's Centos 5.9
Try:
for dest in /home/*/public_html/
do
cp test1.html $dest
done
Since you are writing in user-owned directories be careful of you umask setting - it controls permissions on the file. You can use cp -p
to keep the exact permissions on test1.html preserved.