13 April 2011

AppleScripting Wordpress Synching

At the time of writing this I am manage about a dozen wordpress sites of varying sizes. I mentioned in a previous article that I encourage site owners to learn about their sites and make changes.

The problem with that is that you need to make sure you can undo any damage they do to the site quickly. To that end I implement some scripts and plugins to backup and sync Wordpress databases and themes to repositories on the web server. Then once a month or so I need to go in and retrieve all these backups.

[LIMG1]Transmit is simply the best FTP program I've found. It's not free but its stability has been worth every penny to me.

One of the great features is its ability to be scripted using applescript. Let me preface all of this by saying that, as useful as applescript is I am not a big fan and find it as frustrating and inflexible as it is useful at times.

The laptop I do all my work on is a Macbook Air with a very small SSD drive. I really can't afford to host separate copies of each Wordpress site, and why would I? The code is almost identical across all sites except for themes and plugins.

I have a separate transmit folder where each bookmark has the word SYNCH at the end. Those bookmarks each open to specific local and remote directories all set to backup a specific theme. Then I simply use the applescript to open up each one in turn and do a downward sync of all files.

The Applescript code is pretty straighforward. Get it here: main.scpt

That's it. Simple and effective.

Filed in: Nerd  

Comments: This is a tiny site and comment moderation is a pain. Let's use social links to have a conversation on a bigger platform: