I have around 90 websites I need a plugin installed on (wordpress) and I was wondering if there's a way to copy the plugin folder to all of them in a single run (i.e., simultaneously / in parallel).  These are all on the same cPanel so same path, except for the domain name.

The paths look like this:

  • /home/user/site1/public_html/wp-content/plugins/
  • /home/user/site2/public_html/wp-content/plugins/

and so on.

I obviously tried the following, but it takes a lot of time :)

scp -r /path/to/local/dir /home/user/site1/public_html/wp-content/plugins/

If all destination folders are /wp-content/plugins/, then you could iterate using find command, for example like this (assuming you are using bash and directory names have no 'space'):

for dir in $(find /home/user -name wp-content); do
  [ -d ${dir}/plugins ] && scp -r /path/to/local/dir ${dir}/plugins/

You can use for loop which will do the job!

for i in {1..90}
 # your-unix-command-here
 # scp -r /path/to/local/dir /home/user/site$i/public_html/wp-content/plugins/ 
 echo $i

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.