Sunday, November 08, 2009

SyncToy 2.0 - A Windows 7 Tool by Microsoft Home Server Team

toolsLast week, I was asked to investigate an issue of backup some files from remote network drives. I thought the basic concept is to find out if a file has been changed or not. This could be file name, modified date. It can go further complicated such as file name changes, deleting, as well as content change. This must be a very common issue in Windows platform, I thought, and there must be something available such as libraries or tools.

Soon I found out SyncToy 2.0, a free Windows utility application offered by Microsoft. It was actually for Windows 7. The tool is based on Microsoft Sync Framework File Synchronization Provider. In other words, you can use the tool or use the library in .Net. The tool provides three basic actions:

  • Sync: bi-directional sync, any change in either left or right will synced to opposite side. New and updated files are copied both ways. Renames and deletes on either side are repeated on the other.
  • Echo: any change on the left side will be echoed to the right side, but any changes on the right side will not be on right side or reload to right side. New and updated files are copied left to right. Renames and deletes on the left are repeated on the right.
  • Contribute: only new files on left side will be added to the right side. New and updated files are copied left to right. Renames on the left are repeated on the right. No deletions.

For my case, Contribute is the right action for me. I tried this tool and it works well. If there are a lots of files on the left side, the first time may take long time since all the files will be copied to the right side. The later sync process may be much faster if there is a few files changed or no change. It can be used against network drive and the sync process can be done as a scheduled job with sync name. Each sync is defined as a pair of left and right, with additional options such as file exclusion, hidden files and more.

The tool provides log under current user profile. I think the log file is saved at %userprofile%Local Settings/Application Data/Microsoft/SyncToy 2.0. The left and right sides, there are some hidden dat files, which store sync information for the next sync.

There are also some examples of how to use the Sync Framework. I think this provides more more control over how to sync and realtime sync.

Reference: a blog on SyncToy 2.0 by Microsoft Home Server Team.