Thursday, January 14, 2010

How To: Synchronize files on two computers

You have a laptop and a desktop, and you want to synchronize your documents so that both computers have the latest versions of all your files. Or you have a Flash memory drive where you keep copies of the files you're working on, and you want to synchronize the contents of the My Documents folder with that. Perhaps you have an external hard drive that you use as a mirror disk, for emergency backup, and you want to ensure that the files it holds are all up to date. These are all common tasks, but Windows provides no easy way to accomplish them.

 
 

Drag and drop

One way you could try to do this is simply to copy the files from one location to another using drag and drop. This is simple and requires no software that you're unfamiliar with, but it's error prone. It's all too easy to overwrite a file with an older version, losing all the changes you've made. It's also slow, especially when synchronizing files on two computers are connected using a network, because if you try to copy a block of files, Windows will copy all the files you selected, not just those that have changed and need updating.

Using XCOPY

The Windows command line utility XCOPY has options that can be used to copy only files that are newer than those already in the destination folder. You can create a batch file to simplify this procedure.

Using Notepad, create a file containing the following two lines:

XCOPY "%1" "%2" /D /I %3
XCOPY "%2" "%1" /D /I %3

and save it in your Windows folder as SYNC.CMD. (This is for Windows 2000 or XP. If you are using Windows 95, 98 or Me, replace XCOPY with XCOPY32 and save the file as SYNC.BAT.)

To use the batch file, open a command prompt and type SYNC followed by the paths of the two folders you want to synchronize, each in quotes. If you want to synchronize subfolders as well, add /S to the command line before pressing Enter. For example, suppose your project is kept in a folder called "My Project" on both your local PC and one with a network name of "DELL". To synchronize this folder, including any subfolders, type the command:

SYNC "C:\My Project" "\\DELL\My Project" /S

We recommend that you test this on something unimportant before trying it on valuable work files. Note that the two-line batch file has no "idiot-proofing", so it will happily try to synchronize entire hard disks if you tell it to! This method works, but it gets tiresome having to type in the paths of the two folders.

 
 

Windows Briefcase


Most versions of Windows have a little-known tool called Briefcase that is intended to facilitate transferring files between work and home. One of the reasons it's little known is that it is not really a lot of use. It can't be used to synchronize files or folders across a network, but you can use it to create copies of files that can be transferred to another computer across a network, and then used to update the originals when they are transferred back. You can also create a Briefcase on a floppy disk or Flash drive, and then transfer it manually between computers.

To use the Briefcase:

0 comments: