SyncToy
More customizable than Robocopy, this Microsoft PowerToy is great for quick backup or sync jobs
September 18, 2008
As a security or systems administrator, you've probably experienced the delays and hassle that occur when copying large amounts of data from one server to another. Intelligent replication software that's used to synchronize data between directories is certainly not new—Robocopy, Microsoft's standard "free" synchronization software, has been around a while and even has GUI add-on front ends to make it easy to use.
But Robocopy isn’t Microsoft’s only synchronization software. SyncToy, a PowerToy from Microsoft, syncs quickly and offers several customization options, including the ability to schedule jobs instead of running them manually. Let's look at how and when you should use SyncToy to copy data.
Playing with PowerToys
PowerToys are software written by Microsoft engineers but not officially supported by the company. PowerToys were first released with Windows 95 as free, often niche products that someone at Microsoft found useful enough to release to the masses. (You might recall other popular PowerToys such as Open Command Window Here and Tweak UI.) You can download the latest PowerToys for Windows XP directly from Microsoft (http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx).
Microsoft has begun updating popular PowerToys to run with Windows Vista (and many PowerToys already work in Vista) but doesn’t yet have a dedicated site for Vista PowerToys. SyncToy 1.4 is based on the Windows .NET framework 2.0 and works with Vista.
Using SyncToy
You can download SyncToy from the Microsoft Digital Photography Web site (http://www.microsoft.com/windowsxp/using/digitalphotography/prophoto/synctoy.mspx) and while you're there, you can also download a white paper discussing how to synchronize images. The examples from the Web site focus on synchronizing photos between devices and servers, but you’ll quickly find that you can use SyncToy to schedule the replication or backup of all sorts of data.
Download and run the small setup program to install SyncToy. The program asks you where it should be installed—by default it’s installed on the C drive at UsersusernameAppDataLocalSyncToy—but you can start it from the shortcut that the program installs in your Start menu.
The intuitive interface resembles other replication tools, using a familiar left folder and right folder concept to show synchronization options for files. Because the program supports bi-directional synchronization, denoting the folders as left and right is clearer than source and destination or target. To begin, click the button “Create New Folder Pair” to start a short wizard that walks you through the creation of the replication job. Browse to or type the names of the two folders where you want to synchronize files and label one Left and the other Right. Next, specify the type of replication you wish to perform, either Synchronize, Echo, Subscribe, Contribute, or Combine.
Synchronize copies new and updated files between both folders. If you delete or rename a file in either the Left Folder or the Right Folder, Synchronize will perform the same action in the other folder. Echo is one-way synchronization: Actions performed on files in the Left folder, such as updating, renaming, or deleting are mirrored to the Right folder. Subscribe copies updated files in the right folder to the left folder. Contribute is similar to Echo—new, updated, and renamed files in the Left folder are performed on the Right but files deleted in the Left folder will not be deleted in the Right folder. Combine is similar to Synchronize in that new or updated files are copied between the Left and Right folders but renamed or deleted files in one folder are not updated in the other folder.
In each action, SyncToy conducts two passes—it first compares the Left and Right folders to get a list of actions. Then, it executes those actions. This speeds up the execution of the job, as only affected files are actually copied. The first job run takes the longest as every file is copied from the target to the destination. During subsequent runs only changed files (as defined by one of the actions I described previously) are copied, which makes the runtime of the overall job considerably quicker.
SyncToy also includes intelligence on handling renamed files. For example, it can recognize two files that are the same but named differently. Depending on the action you choose, SyncToy can rename the target file to match the source. As a side note, during my testing, I discovered this feature unexpectedly—I thought I could invoke a simple file synchronization by copying a file from the left side to an arbitrarily different directory on the right side. I renamed the file as well. SyncToy discovered the file had moved and been renamed. However, its recommendation was simply to rename the right side file to match that of the left. It didn’t “recognize” two files—it recognized one file which had been renamed.
SyncToy includes a robust built-in Help that explains the differences between these different actions and provides before-and-after examples showing behavioral nuances of each. For example, SyncToy doesn’t actually delete files; instead, it moves them into the Recycle Bin. Also, SyncToy doesn't delete folders—it just leaves them intact, but empty.
After you set up your job you can review it or change specific options, as Figure 1 shows. One great option is the ability to move an overwritten file to the Recycle Bin instead of deleting it with the overwrite—giving you one an additional chance to recover the file should you make a mistake. You can also include specific files in a job setup. For example, you could create one job which backs up all pictures with the extension .jpg to one folder and backs up your music with the extension .mp3 to another folder. You can also exclude specific subfolders from the job.
Before you run your job, test it by clicking the Preview button to view what SyncToy will do when it’s actually run, as Figure 2 shows. Notice that SyncToy shows you the actions which will occur on both the left and right sides of the job.
When you are confident that the previewed actions are what you want to occurclick Run and the program will execute your job, and when complete, show you a summary of the results. As you can see in the left pane of Figure 1, SyncToy shows all of the jobs (folder pairs coupled with actions) that you’ve set up. You can run each job independently or click All Folder Pairs to show every configured job and select some or all of the jobs to run at one time.
Instead of setting up a job that you run manually, you can also schedule jobs by using the Windows Scheduled Task service. For example, you could create a job that runs when you insert your USB drive and combines new or updated files between your laptop and the flash drive but doesn't delete any data. Or you could create a job to regularly copy data stored on your workstation to the hard drive on a remote server. The SyncToy Help file describes how to create a scheduled task to run SyncToy on Vista or XP using the locally logged-on user.
SyncToy works best when working from a locally logged-on workstation and copying files to a remote share or locally connected device. It’s designed to be quick and easy to use. However, it does have limitations: For example, it doesn't easily support running named jobs under alternate “logged-out” accounts (i.e., running a job under a specialty account used only for automated jobs, like a service account). For heavy-duty, automated, offline, batch-copy jobs, I still recommend Robocopy, which you can download as part of the Microsoft Windows Server 2003 Resource Kit at http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en. However for creating quick backup or sync jobs between your workstation and a file server, SyncToy gets the job done quicker and with more customizable options than Robocopy.
About the Author
You May Also Like