How to use Beyond Compare for Backup

In my recent I shared with You, that I ditched all those proper backup programs in favor of Beyond Compare 4 (BC4).
So the questions is, how to use BC4 for backing up? And what are the advantages over traditional backup software?

Why would perform backup with tool which is designed for something else? My answer is proprietary backup archives.

They are pain.

I had used one of the backup programs a couple of years ago and created a couple of backup archives with it. The only way to access the files was to download current trial version of the program, install it and only then I was able to open it. To get the actual data out, I had to start a recovery wizard and wait for it to open the archive. Booring.

What if vendor goes out of business? How would you access your backup then?

What if you switch platforms and vendor does not provide compatible version?

There is advantage to these proprietary archives, they usually support versioning and compression.

Versioning is a nice feature, you can go back to previous versions of your data. For example, you mess up editing a photo or your Excel table breaks apart. With versioning you can recover previous version. However, with this feature more space needs to be allocated for the backup and with a lot of changes in the data backup archive can grow in size.

To combat this, backup software usually provides some level of compression to reduce the size or archive. High compression is CPU intensive operation, meaning backup takes a long time to finish when running as a low priority background process or interrupts your work when assigned a high priority.

Another issue with backup programs is that as they make more versions they keep the old ones and total size of your backup archives grows. To get around this, backup programs offer automatic clean-up for archives or they merge them together. Frequently, this is an extra feature only available in paid versions.

∙∙∙

What if you just want to protect your data?

Simply?

What if you have a second drive and want to keep a second copy of your data?

What if you want to access your backed up files without proprietary software?

In that case…

 

Why don’t you just copy your files to the second drive?

This works only when you’re adding new files.
Let’s say you have files A,B,C on primary drive.
You create your first manual backup by copying files over.
Now your backup contains A,B and C.

Let’s add one more file to primary drive: A,B,C and D.
Backup…
Backup contains: A,B,C and D.

Remove file B from primary drive. Add file E.
Primary drive: A,C,D and E.
Let’s backup…
Backup contains: A,B,C,D and E.

See?

Copying sort of works. However, we need to somehow tell copy operation to remove deleted files from the backup.

And this is what exactly Beyond Compare does. It synchronizes files from one destination to another. It checks for new, changed and deleted files.

It’s not the only program in the world capable of this (I believe Total Commander has a similar feature as well). It’s the one I have been using for some time now. Mostly for comparing contents of two folders. And for comparing source code files when I am programming and need to do a git merge.

Update (2017-12-17): Actually, there is a simple command line tool for synchronizing folders called Robocopy. It’s probably the easiest way how to do a simple backup. It’s even pre-installed in Windows 🙂 Here is an article showing how to use it for synchronization.

∙∙∙

Ok, so we can use BC4 to synchronize folders and their contents. That’s great. But that requires a lot of manual work doesn’t it? Maybe I am just better of copying files after all…

No, please. Automate your backups. Never rely on yourself performing backups regularly.

You gonna forget… or perhaps not, but do you really want to spend 5min every day on something which can be done automatically?

And this is where BC4 shows it’s merits. Beyond Compare comes with a scripting processing feature. You can write yourself a simple script and feed it to BC4.
Luckily, BC already provides a few sample scripts. Let’s take a look at this one:

# Turn logging on.
log verbose "C:\log.txt"

# Load the default session.
load <default>

# Load the base folders.
load "P:\" "S:\"

# Do not prompt (for example, for deleting read-only files in backup destination)
option confirm:yes-to-all

# Copy different files left to right, delete orphans on right.
sync mirror:left->right

Verbose logging, means BC4 will print out list of all changed files. You can also use “log normal” for basic information.
BC4 enables to create various sessions. But default is good enough for my purposes.
Load folders of your source and destination. Make sure your primary folder is on the left and your backup destination on the right.
Yes-to-all option makes sure you won’t be asked to delete read-only files in the backup destination.
And lastly the magical “sync” command. It synchronizes files from left (primary) to the right (backup) destination.

 

Now, how can I execute this script using BC?

This website provides an answer.

1) Just save the script as a text file, for example “bcscript.txt”.

2) And now execute BCompare.exe with the path to the script as a parameter.
“C:\Program Files (x86)\Beyond Compare 4\BCompare.exe” @C:\bcscript.txt

 

So, how do I automate my backup?

Create backup task with Task Scheduler.

This page shows how.

1.In Windows Task Scheduler, pick Action > Create Basic Task to get a wizard.

2.In Action, pick Start a program.

3.In Program/script, pick the Beyond Compare 4 executable.

4.In Add arguments, add a reference to your script file:
@bcscript.txt

5.In Start in, pick the script folder:
C:\My Scripts

Also make sure to set task Trigger to schedule backup task to run (eg. daily or weekly) as you see fit.

Screenshot above is just an example 🙂

And that’s it. Enjoy your backup.

Bonus:
You can force your task to run using desktop shortcut with following target:
C:\Windows\System32\schtasks.exe /run /tn “BeyondCompareBackupTaskName”

Basically, you are telling Task Scheduler to run a task named BeyondCompareBackupTaskName.

And how do you backup? And with what software? Let me know in the comments. Perhaps I am doing it all wrong 😀


Comments

One response to “How to use Beyond Compare for Backup”

  1. Jacques

    For backup my wife and I use the History File Backup in W10. It works fine. I’ve been using BC for years, it’s easy to use and it does a very good job. I never thought of using it as a backup application until I saw your post. I’ll try it. Thanks for this.

    As a septuagenarian I like to tinker with computers and applications to keep my neurons active.

Leave a Reply to Jacques

Your email address will not be published. Required fields are marked *