On my local machine I have several plugins, and on the server I have a few.
Local Machine:
~/wp-content/plugins/plugin1 ~/wp-content/plugins/plugin1/includes ~/wp-content/plugins/plugin2 ~/wp-content/plugins/plugin3 ~/wp-content/plugins/plugin4 ~/wp-content/plugins/plugin5
Remote Machine:
~/wp-content/plugins/plugin1 ~/wp-content/plugins/plugin1/includes ~/wp-content/plugins/plugin3 ~/wp-content/plugins/plugin5
What rsync command can I use to update all the files in the remote directories, but only if they exist? For this I would like to have plugin1, plugin1/includes, plugin3, and plugin5 synced – with all files and directories inside – but not plugin2 or plugin4. Basically, update all of the plugins if they exist with a single rsync command.
This is not completely possible with only one rsync command. If you only want to update the remote files, but do not want to add new files, you can use this command:
This will not create new files or directories at all, but update differing ones.
Edit: Maybe you could do something like this (assuming GNU find, if BSD/OS X: replace maxdepth with depth):
Warning: I have not tested this, you might want to add a “-n” to rsync (dry run) to see what happens.