The item below is reprinted from the Spring-Summer, 1995 IDI Newsletter (printed predecessor of this web site). As far as I know this is still a dependable way of synchronizing a user's files when he or she moves from one computer that supports DOS commands to another. I still find this handy when I move between my own office and a client or university site.

I've added footnotes to update it to today's Windows environments.

- Conrad Weisert

System management tip . . . by Bitzen Beitzmann

REPLACE helps synchronize off-line directories

A helpful tool in managing files on your office computer, your home computer, and your portable is the REPLACE command found in version 6 or later of DOS. Suppose you have a directory with the same name1 on each computer's fixed disk2, and that you want to be able to work on any file in that directory on any computer. Using a diskette3 for communication, you can prepare a batch procedure DIRSYNC.BAT

  REPLACE %1\*.* %2 /A    (add new files) 
  REPLACE %1\*.* %2 /U    (replace if later date)
  REPLACE %2\*.* %1 /A    (do in
  REPLACE %2\*.* %1 /U       both directions)

Now if you execute

on one computer, carry the diskette3 to another computer, execute the same command on the second computer, and later repeat the process on he first computer, the two INCLUDE directories will then both contain the current versions of each file. As a bonus, the diskette2 will serve as a full backup to both.

To make the procedure more foolproof4, you can CALL DIRSYNC from another batch procedure that knows the names of the directories you routinely want to synchronize.

Of course, this works only if you're a single user observing the disciplne of not updating the same file on two different machines without an intervening DIRSYNC. It also doesn't take care of file deletions (they'll keep coming back!), but you can build a more elaborate procedure that does.

1—Actually, they don't have to have the same names, but it's good practice
2—or network accessible storage
3—or other removable storage medium
4—We're assuming that the system date and time on each computer are in agreement, or that if you move to another time zone, the difference will have elapsed. Obviously running this procedure or updating files on a machine with an erroneous system date may destroy your valuable files.

Return to IDI Home Page
Return to Technical articles

Last modified 18 March 2010