If you see fewer posts. . .

it's because I don't post much anymore.

Wednesday, September 21, 2005

How to backup your blog.

Who deleted your blog? Well, no one yet, but it could happen. One day http://yourcrappythoughts.blogspot.com could be gone. And how would you feel about that? Pretty crappy I would guess. I month back or so I posted an entry about using wget to backup your blog, but I didn't provide complete information about how to install the program and actually get it done. So this blog entry will be devoted to that purpose. Here we go.

  • Linux Users
    • Make sure wget is installed.
    • Create a directory to hold your blog. (i.e. /blogs/yourblog)
    • Create a file called backup with the following 2 lines in it
      (Line 2 wrapped.)
      1. #!/bin/bash
      2. wget --wait=1 -r --span-hosts --level=2 --domains=photos1.blogger.com,yourblog.blogspot.com
        --convert-links http://yourblog.blogspot.com/ &

    • Run the command ./backup
    • You're done.

  • Windows Users
    • Use google to search for wget for windows.
    • I found a copy at http://gnuwin32.sourceforge.net/packages/wget.htm
    • Download the setup program and save it to the root directory of your C drive.
    • Launch the executable, and accept the agreement, and start the install.
      • Install to a new folder called c:\blogs.
      • Don't install the documentation, just the binaries.
      • If asked, don't create a Start Menu folder. There's too much junk in there as it is.
      • If your are promted to optionally download sources, don't do that either.
      • Install should complete quickly.
    • When the install is done, go to the DOS shell and CD so that you are in the c:\blogs directory.
    • Feel free to delete all directories except for the bin directory. I don't think anything else is necessary. It does put some entries into the registry, so you might want to keep the directories anyway, but don't be confused - you will never be going into any of the directories anyway.
    • Make a new directory that is the name of your blog. (MD YOURBLOG)
    • Change to that directory (CD YOURBLOG)
    • Type edit backup.bat and hit enter.
    • Create a batch file with the following lines:
      (Line 2 wrapped.)
      1. path=%PATH%;c:\blogs;c:\blogs\bin
      2. wget --wait=1 -r --span-hosts --level=2 --domains=photos1.blogger.com,yourblog.blogspot.com --convert-links http://yourblog.blogspot.com/

        I found that the above string didn;t work lately but found another one that did:

        c:\progra~1\Gnuwin32\bin\wget -v -r -p --wait=1 -erobots=off --level=2 --convert-links --span-hosts --domains=yourblogname.blogspot.com,photos1.blogger.com http://yourblogname.blogspot.com/

    • Do an ALT-F and hit X to Save and Exit.
    • Now just type backup and hit enter.
    • You're done.
The files you wind up with will be able to be browsed on your PC just like you were on the web.

Oh, and one more thing, if you get errors for some reason, you might want to increase the --wait=1 part to --wait=7 or something so that the blog site doesn't think your program is some kind of image harvesting program or something. Just an idea.

0 comments: