Return to Digital Photography Articles
Beyond Compare 2 is a great program that is generally used to verify or compare the differences between two files. But in recent versions it has grown to include a very powerful scripting mechanism and the ability to perform synchronization or mirroring between folders. This lends itself very well to the task of creating an automated mirror backup. This brief article examples the use of Beyond Compare for the purposes of creating an automated backup. While this is not the most common use for this tool, it does highlight its flexibility. For strict file comparison purposes (using the hex editor view), this tool is indispensible.
Scripting an automatic backup
Within Beyond Compare 2, I have created a session called PhotoMirror. It is set to mirror right all files from my source directory to the destination mirror. The source directories are marked as read-only.
I then use a script named SynchPhoto.txt which is used to invoke the session operation, shown below. Special thanks to Marjolein for several recommendations included below.
# Make any errors fatal and visible option stop-on-error # Turn logging on log verbose append:"F:\MIRROR\BC2\SyncPhoto_log.txt" # Load the session (defined already within BC2) load "PhotoMirror" # Open up all of the folders expand all # Catch changes including metadata (EXIF, IPTC) criteria size CRC # Begin the synchronization from "left side" to "right side" sync create-empty mirror:lt->rt # Perform the same steps with the IMatch database load "IMatchMirror" expand all sync create-empty mirror:lt->rt
The IMatchMirror session was created to backup all of the IMatch database data. This includes the database in addition to any scripts or configuration files. As one often needs to download and modify scripts for photo management applications, preserving the script directories is quite important. In my case, the following directories are copied:
E:\IMatch\MainDB (which contains my database files: e.g. *.imd, *.imt, *.i3x, *.imc, etc.)
E:\IMatch\Scripts
E:\IMatch\Presets
The session uses "Size and CRC" for the comparison and doesn't specify any excludes. If one wanted to preserve multiple copies of the database (for rolling back to an earlier version), one may consider exclude the thumbnails, which occupy significant file space. Apparently one can recreate the thumbnails, which would mean that you may be able to specify an exclusion for the *.imt files.
Note that I have configured IMatch to place all of my files in a single location, not on the boot drive. There are many reasons why this is advantageous: for performance and safety of your data.
Windows XP Scheduled Tasks
Built-in to Windows XP is a Control Panel utility called Scheduled Tasks that lets you specify a number of programs to run automatically at scheduled times.

To create a scheduled event, one simply double-clicks Add Scheduled Task and then step through the options displayed in the Scheduled Task Wizard. Upon entering the wizard, the computer will take some time to scan your entire drive for any registered applications that it determines can be run as a task.
If you cannot find Downloader listed, then you will want to click on Browse... to locate the program manually. You will then be asked for a name for the task in addition to the basic scheduling options (ie. The frequency of the task, when it starts, etc. It is important to consider these options carefully.
The first choice you will need to make is whether you can run the task when you are not using the computer (ie. 3:00 AM). Laptop computer and many desktop computers can be configured to wake up temporarily to run a task. In laptops, this is almost always the case. For desktops, however, you often need to configure your Power Options in the Control Panel properly.
In particular, I find it easiest to set my computer to automatically go into System standby mode after one hour (as configured in the Power Schemes tab). This way I don't have my machine running all night, and I simply allow it to put itself to sleep every night, rather than selecting Shut down from the Start menu daily. NOTE: it seems that some programs don't handle the recovery from standby or hibernation that well. I have encountered one or two crashes that I attribute to this, and will have to experiment further.
Scheduled Tasks need a Password
If you plan on running the task when you are not logged in (ie. overnight), then I discovered that you will need to create a user account in Windows XP. Windows XP does not allow a guest account to execute a script. Originally, I didn't have any accounts set up on my machine (ie. Windows would immediately start up without asking for a username or password). But I noticed that scheduled tasks wouldn't run properly. Investigating further, I realized that I needed to create an account. For more details see Microsoft Knowledge Base Article Q310715.
Running script from a Shutdown state?
I think it might be possible to get the computer to wake from the Shut down mode, but I haven't managed to do this on my desktop computer.
Limitations of Beyond Compare for Backup
While I had used BeyondCompare for quite some time as a mirroring tool, it doesn't easily provide a mechanism to create change-sets (or preservation of older revisions of files). In addition, it is a bit of a hassle to create a script and set up a scheduled task. For these reasons, I have since switched to a different tool to do my hard drive "mirroring" process.
That being said, I still use it regularly, but for its primary purpose: comparison of files, relying on the Hex Editor viewer. In this manner it is still one of the best utilities for this purpose.
Beyond Compare 2 | |
Cost: | U$30.00 |
Trial? | Yes. 30 day. |
Vendor: | Scooter Software |
Web: | www.scootersoftware.com |
Prices as of October 2006 |
Reader's Comments:
Please leave your comments or suggestions below!Another alternative to sync drives or directories is the freeware SyncBack from 2BrightSparks. (One advantage over SyncToy is that - like BC - it is not dependent on Windows XP but works just fine on Windows 2000, which many people still use.)
It has extensive options, including a built-in scheduling wizard. One nice option that BC doesn't have is that it can close (named) open programs before starting, to avoid skipping locked files.
I use either BeyondCompare or SyncBack depending on what I need to do.
I'm using BeyondCompare as well - but use a few extra commands compared to your script:
criteria size CRC
Since for image files EXIF or IPTC data may be changed without a change in file timestamp or file size (both IMatch and ExifTool can do this), this ensures such differences are detected as well. Obviously this is slower than the more common timestamp & size criteria setting but more reliable.
option stop-on-error
That way, next morning, you'll immediately know if something went wrong without having to load the log file.
Thank you very much Marjolein... These are excellent suggestions. I have added the criteria check to the script described above. I had originally written the article before I started working with an IPTC workflow, and therefore didn't run into that problem.
I have since moved on to another tool for mirroring my photos because BeyondCompare didn't provide a means by which I could easily create rollback versions of my files (in a subdirectory containing X old versions). I put in a feature request, but not enough users have highlighted it as important, I suppose. Mirroring is not much good in protecting you against the human error element: accidentally corrupting/overwriting a file. So, I have moved on to another tool, DirSync, for this purpose.
Have you considered the Microsoft SyncToy which can do these sorts of backups automatically also and is free. It seems quite a reasonable alternative for photographers.
Thanks for the recommendation -- I wasn't aware of SyncToy. I am going to evaluate it.