There is a directory
YYY and a structure on the site:
site1.ru/wp-content/plugins/ site2.ru/wp-content/plugins/ ... site10.ru/wp-content/plugins/
YYY directory to copy all directories
plugins which are available on the server.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
only can copy only to one destination , so you have to use a loop or do something like
echo dir1 dir2 dir3 | xargs -n 1 cp file1
Which will copy
xargs will call
cp 3 times to do this, see the man page for
xargs for details.
cp only takes one destination at a time, so call it in a loop.
for d in */wp-content/plugins/; do cp -Rp YYY "$d" done
Note that this snippet will keep going if any of the
cp commands fail. To abort immediately on failure, run
set -e first. To keep going (makes sense on permission denied, not on disk full) but still report errors, save the return status in a variable:
ret=0 for d in */wp-content/plugins/; do cp -Rp YYY "$d" || ret=1 done return $ret # from a function; `exit $ret` in a script