Shell script for cloning a WordPress installation

The shell script below will copy a WordPress installation from one server to another- including the database. The script uses the ‘sed’ command to update the new wp-config.php with the new server information, as well as replace all references to the original domain (such as in post_content) in the new DB with references to the new domain.  I wrote the script in order to create a ‘one-click’ solution to mirroring a WP installation.  It will work with both single and multisite installations.

WARNING: Use at your own risk.  I recommend that you manually back up the original WP installation until you are confident that the script is configured correctly.  It is possible to inadvertently alter or erase your original installation if you do not configure the script’s variables correctly. The script was written in the Mac OS environment and may require some alterations to work in your environment.

Share