Keeping two HDs synchronized with MPW

As a contractor, I often find myself carrying a portable drive or a laptop back and forth to client locations. This means that I need to keep two drives in sync. I use the following commands in MPW to create menu items (in a menu called 'Dave', which you might want to change) to sync a desktop drive (named HD) to a portable drive (named portable).

addmenu Dave "To Portable" "backup -from HD:development: -to Portable:development: -r -a -do only,'UnlockAndDuplicate'"
addmenu Dave "From Portable" "backup -from Portable:development: -to HD:development -r -t TEXT -a -do only,'UnlockAndDuplicate'"

Copying from the portable disk, I've decided to only copy text files, as I'm not often editing non-text files, and I can usually remember to keep them in sync manually. If that's not the case for you, you can remove the -t TEXT from the second line above. Both of these call the script 'UnlockAndDuplicate' which will unlock a locked destination file (so the duplicate doesn't fail), and then duplicate the file. I store it in my 'User Commands' directory within the MPW directory. The script is below:

set echo 0
SetFile -a l "" || ()
Duplicate -y "" ""

That's it. Thanks to Greg Branche for suggesting using a separate user command to avoid problems with the duplicate not being able to overwrite locked files.

Copyright 2009, Dave Polaschek. Last updated on Mon, 15 Feb 2010 14:09:27.