Sunday 11 January 2015

Backing Up Your Blog

What would happen if you accessed your blog one day and all of the posts were going? Or the blog itself was gone?!

I don't know how likely this is, but I decided to make a back-up just in case.

I did this in two ways:
1) I exported the blog (using Settings, Other, Export Blog)
2) I used Wget to capture a copy of the blog

The command I used for this was as follows:
wget -rH -Dpetermccullagh.blogspot.ie,bp.blogspot.com -k -l 0 http://petermccullagh.blogspot.ie

The parameters are as follows:
-r tells Wget to work "recursively", i.e. to get the pages and files that are references in pages which it is processing
-H means that it is not limited to the same host. This was needed because my images (which I wanted to fetch) are on a different host
-D told Wget which hosts I wanted it to include. The second one is for the images
-k converts the links to refer to local (relative) addresses after the download
-l 0 turns on "infinite recursion", so Wget will fetch pages, which fetch pages, which fetch pages etc.

So now I have a local copy of my blog with relative links to other pages and images from the blog.