We use cookies to provide you with a better experience. If you continue to use this site, we'll assume you're happy with this. Alternatively, click here to find out how to manage these cookies

hide cookie message

Back up blog or FTP directory with AppleScript

Reader lucaslivingston has a WordPress blog, and wanted to make sure to back it up regularly. But while there are plenty of WordPress plugins that claim to do backups, he frankly found them daunting. Instead, he decided to create his own simple Mac-native solution using AppleScript, and then set up a daily iCal event to run that script at 4:00 every morning.

Simulates a double-click on the alias to the Web server where his WordPress blog lives, mounting it as a WebDAV volume (just like iDisk);

Runs the handy Unix backup command rsync to copy the remote contents locally; and

Unmounts the web server.

Here's the script. Open AppleScript Editor and paste the following into a new window, then save it as an Application:

set filepath to "Macintosh HD:Users:USERNAME:Library:Favorites:www.example.com"

tell application "Finder" to open filepath

delay 30

do shell script "rsync -av /Volumes/www.example.com/blog/ '/Volumes/Backup/wordpress-backup'"

tell application "Finder" to eject "www.example.com"

If you're adapting it, you'll obviously need to provide you own user name, domain, and backup destination in the script. You should be able to use this with any web server or FTP directory that you work with.

It's important to note that this doesn't back up the actual WordPress database. In the original hint, I mention a plug-in that I use to back mine up.

IDG UK Sites

Acer Aspire R11 review: Hands-on with the 360 laptop and tablet convertible

IDG UK Sites

Apple Watch release day: Twitter reacts

IDG UK Sites

See how Framestore created a shape-shifting, oil and metal based creature for Shell

IDG UK Sites

Apple Watch buying guide, price list & where to buy today: Which Apple Watch model, size, material,?......