简体   繁体   中英

Linux command cp producing omitted directory

I want to place 1 file called "test1.html" in 100 different directories of website.

cp: omitting directory `/home/domain1.com/public_html/'
cp: omitting directory `/home/domain2.com/public_html/'

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.

尝试这个:

cd /home/; find . -name public_html -type d | xargs -I {} cp /root/test1.html {};

It should be written: cp -R test1.html \/home\/*\/public_html\/<\/code>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM