Pages

Friday, January 18, 2013

Automatic backups using SyncToy

In a previous article, I wrote how to do manual (well, semi-automatic) backups using Microsoft SyncToy. What I mean by manual is that you have to “tell” it to backup. It is a simple program. There is no automatic backup scheduler built into the program itself.

But you can always use Windows Task Scheduler (or Scheduled Tasks) to do that. However, you cannot do it if the program does not allow command line arguments. But luckily, there is a command line version of the tool that gets automatically installed when you install SyncToy.

The command line arguments for backing up

You can make new folder pairs using the command line tool as well. But I prefer to do that using the GUI. But if you need to create folder pairs using the command line, you can refer to this site.

But for simply automating the backups of already created folder pairs, use this command.

For a single folder pair: SyncToyCmd -R folder_pair_name

To sync all folder pairs: SyncToyCmd -R

We'll be using the latter, but you can use pair wise backups so that you can perform different backups at different times or frequency. (Say, you need to backup documents and pictures everyday and music and videos every week. Just make sure that the backup tasks don't overlap. If you are not sure about this, let it backup all folder pairs in one go.)

Creating the automatic scheduled task

Note: if you are backing up to an external drive which is connected on demand, this method is not ideal because the human factor has to be involved at some point; i.e. plugging in the drive. )

You simply go into scheduled tasks, create a new task with the appropriate command line argument and specify the time that it should run and the backups will be automatic. Always make sure that the task works by manually testing it. (Put a new file in Left folder of one of the folder pairs and run the task. If things went fine, the file would be copied to the respective Right folder.)

What's the right time to backup?

You can set the task to run whenever the PC is idle or at a particular time of the day or week, but I prefer the latter.

Why? Almost all the time, my WD Green drive is powered down to save power and reduce wear and tear. I don't want it to frequently come out of that sleep, when most of the times there won't be anything new to backup. I would probably let it run once every day, and around 10PM.

Screenshot

Here’s what you would see when running the command line version of SyncToy.