While setting up my WordPress site, I was looking for backup solutions in the case where something goes wrong. WordPress offers a lot of plugins which will create and manage database backups but I did not find anything that would take care of the WordPress files themselves.
I know a lot of people hack and change the WordPress files, themes, and plugins to suite their own needs and, in a lot of occasions, a simple click on the “Upgrade” button trashes all the changes that have been made. I needed something that will create a backup of my entire WordPress installations files, database, and all.
So, I wrote a little script which takes care of exactly that. It creates backup files which contain packed versions of the WordPress installation along with a snapshot of the WordPress database. The files are protected by an MD5 sum and contain a timestamp of the time of the backup. The script is a pretty simple Python script. Here is a bit more information from the README file:
WP_BACKUP
=============================
Backup your WordPress installation/site with one script.This script can be used to perform backup and restores of
a WordPress installation. The script can backup the WP
installation under the webserver Document Root directory,
preserving any modification that might have been made to
the source code. It also can backup the WP database,
preserving any WP content that is already there.USAGE
==============================
The script has two modes of operation: backup and restore.With both backup and restore, you can specify where the
backup files are located using the ‘–backupdir’ option. By
default, the script will look in the current directory.To backup a WordPress instance, use the ‘–backup’ option.
The ‘–backup’ option requires the ‘–wordpress’ option,
which lets the script know where the WordPress files are
located.To add the WordPress database to the backup file, add the
‘–db’ option.To restore a WordPress instance, use the ‘–restore’ option.
There are two ways to restore a WordPress instance:1. Let the script the script find the most recent
backup file in the BACKUP_DIR directory2. Point the script to a specific backup file by
using the ‘–path’ option.You can also tell the script whether you want it to restore the
MySQL database (dropping any existing database) or whether you
want it to extract the SQL statements to a file. If the
‘–db_to_mysql’ option is used, the script will restore the
database directly to the MySQL server. Otherwise, it will be
writen in the form of a text file containing all necessary SQL
statements in the current directory.
![WordPress backup script While setting up my WordPress site, I was looking for backup solutions in the case where something goes wrong. WordPress offers a lot of plugins which will create and manage [...]](http://www.voidtrance.net/wp-content/uploads/2010/01/code-620x250.jpg)


Hi Mitko,
That’s awesome that you created this script for everyone to use, but is there any way you could provide further instruction on how to use/configure this for us or aren’t python savvy? This looks like the golden ticket to a solid backup/restore solution.
Hunter,
Sure, I will try to expand the README file included in the tarball with more instructions and some example.
In the mean time, if you have any specific questions, feel free to ask.