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

Best Christmas 2014 UK tech deals, Boxing Day 2014 UK tech deals & January sales 2015 UK tech...

IDG UK Sites

Apple's 2014 highlights: the most significant Apple news of 2014

IDG UK Sites

2015 creative trends: 20 leading designers & artists reveal the biggest influences & changes coming)......

IDG UK Sites

Ultimate iOS 8 Tips: 35 awesome and advanced tips for using iOS 8 on iPhone and iPad