They say you learn something new every day.

And so my backup quest continues. What I learnt today was probably the most important thing so far: actually backing up the files on my computer.

There were three important requirements to my plan:

  1. It must be automatic.
  2. It must be free.
  3. The process must not affect my life or computer use.  

I turned today to looking at ways at backing up the important files on my computer.

My plan with these is to upload them to my webserver. This will probably be quite a big job at first, because there are a lot of them, and I’m happy to do this once, as long as I can do automatic incremental backups from then on.

Thankfully, I found WinSCP. Having played with it a bit now, I like WinSCP – perhaps more than Filezilla. For my purposes, what is really useful about WinSCP is that it allows you to run commands from the command line.

It took me a little while to figure this out, but I got there in the end. First you need the .bat file, something like this:

winscp /script=file.txt

This will run winSCP against the commands stored in file.txt

Then we create file.txt:

open ftp://USERNAME:PASSWORD@ftp.SERVERNAME.com
synchronize remote “D:\Files” /www/Files/
exit

This logs onto the FTP server with the given credentials and synchronizes the local file against the remote one. It adds all the missing or updated files.

What’s particularly good is you can add lines and lines of as many folders as you like. It works so well, that I’m thinking of setting all my FTP folders up like this, and ditching FileZilla entirely.

However, I still had a problem. Running the .bat file loads up a command prompt window.

 Black window of fear

Now these windows are harmless enough (although I remember a friend saying to me once “whenever I see one of these I just think ‘something has gone really wrong’.”)

However, remembering back to #3 I don’t want the process to affect me. And a black window popping up does. Allbeit not very much. Look, I just don’t want to see the black window, okay?

Luckily, there’s a way round this. Instead of running a bat file, you run the command in vbscript:

 ’Create scripting Object
Set oShell = CreateObject(“Wscript.Shell”)

 ’Run script in invisible mode
 oShell.Run “winscp /script=UploadList.ini”, 0, false

This runs the command invisibly, so I don’t even know it’s doing it. And because it’s a synchronise, it will just identify all the new or changed files and back them up.

I could put it as a scheduled task, but I turn my computer off and on everyday, so I’ll stick it in the Startup folder, and just let it run when my computer boots up. Backup plan complete, I believe.

What’s also good is that it’s another command line piece of software for me to add to my collection. I’m aiming to use a lot more command line software in 2012 and automate more things if possible.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud

%d bloggers like this: