I develop my web sites from more than 1 computer typically. So, in the case of all my web sites developed with WordPress, I need to have a local copy of the
wp-content/uploads folders on each development machine if I want to test anything for my web site locally — on my laptop, for instance — before pushing it back out to the web server.
FYI: Computers, laptops and servers I use are all powered by Linux.
The easiest way to get a current, up-to-date version of a WordPress-powered web site’s uploaded content i.e.
wp-content/plugins folders, is to use the very helpful
I maintain a little bash script to help me to do this easily, repeatedly, and from any laptop or computer I use, and I will also now share it (just the essential bits) here, in case it is something that you might find useful too.
You can also just copy and paste it to your favourite terminal window too.
# The path to the remote server's WordPress folder _WWW="/var/www/html" _WP_CONTENT="$_WWW/wp-content" _UPLOADS="uploads" _PLUGINS="plugins" # Replace '[email protected]' with your host info DIRS_SRC="[email protected]:$_WP_CONTENT/$_UPLOADS :$_WP_CONTENT/$_PLUGINS" # Set the path below to your local WordPress wp-content folder DIR_DES="$HOME/domains/example.com/wp-content/" # The rsync command with archive|compress|partial|progress|verbose options set rsync -azPv $DIRS_SRC $DIR_DES
The first time it runs, it will take a while, because rsync (to sync both folders) must download everything that’s already there in the remote (production) server with the local machine, but on subsequent runs, rsync should only download new or modified files.
I also maintain a little helpful BASH script for me to quickly download any WordPress-powered web site’s database that I manage, but I will share that information another day in another post, perhaps.