Automating a Synchronization

How can Beyond Compare be used for automated synchronization?  The first step is creating a script text file (*.txt).  Beyond Compare's help file includes specifics about creating scripts but here is an example of one that is useful for mirroring updates to an ftp site:

# Turn logging on
log normal "C:\Distrib\Synclog.txt"
# Set comparison criteria
criteria timestamp size
# Exclude certain file types
filter "-*.*~"
# Load the base folders
load "C:\Local" ""
#Make the target identical to the source
#includes deleting files that only exist on the target side
sync mirror:lt->rt

This example uses a log and filters.  Logs are very useful for keeping track of changes.  In order to prevent copying of backup files, they are excluded.

The script file can be run from the the command prompt by passing the full filename for the script preceded by '@' as the parameter for Beyond Compare.  For example:
    "C:\Program Files (x86)\Beyond Compare 4\BCompare.exe" @C:\bcscript.txt

However, this is still slightly inconvenient.  Instead, automate the process by creating a scheduled task.  In the Windows Control Panel, look for System and Security | Administrative Tools | Scheduled Tasks.  When you add a new task, Windows provides a wizard.  Among other things, it asks you how often to perform this task.  For example, you might chose update daily on weekdays at 1:00am.  Before finishing, click on the checkbox to open advanced properties.  Edit the Run: field to mimic the command prompt signature (ie add @scriptfilename).  Edit Settings as you chose and make sure the task enabled box is checked.

Note: If you don't include the /silent switch and the task runs while it's not logged in the script will hang.  If you have trouble, check out the Scheduled Tasks error log: "SchedLgU.txt" in your Windows folder.

Confirmation Prompts:  During normal operation Beyond Compare prompts to confirm many file operations, such as deleting or over-writing read-only files.  When you use the /silent switch, the GUI is completely suppressed, so Beyond Compare answers no to all file operation prompts.  To override this, use the command:
    option confirm:yes-to-all

You're all set!  Your computer will automatically mirror your data to the FTP site even if you are not logged in on the computer.

Copyright © 2017 Scooter Software, Inc.