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

Amazon 3D smartphone release date, price and spec: The hologram phone?

IDG UK Sites

iPhone 5s review: why the iPhone 5s is still the best phone you can buy in 2014

IDG UK Sites

Passwords don't work: here's four ways to fix them

IDG UK Sites

The art of rebranding: Creative agency The Neighbourhood explains how & why it rebranded