MPW's Get/Set Duality

Here are examples of the usefulness of "Setxxx" commands that return current settings in the form of commands that apply those settings.

Example: Saving and Restoring the Environment

The SetKey command displays and sets key bindings. The form

sets the keystroke key to execute the command command. The form

displays the current setting for the key key (as a SetKey command, of course), and the form

outputs the current bindings for all keys.

Thus, you can save all the current key bindings with a command like

Then you can mess around with changes, for example

And you can restore all the previous bindings with the sequence

Example: Transferring Folder Protections

More than once, I had the job of replacing the hard disk on the departmental file server with a bigger one. Transferring the files from the old disk to the new one was the easy part: but how did you transfer all the folder ownerships and protections as well?

No doubt, there are commercial backup/restore utilities that will do this for you. But why bother buying one of these, when you've got MPW?

MPW provides a standard command, SetPrivilege, which allows you to examine and change folder ownerships and protections. In particular, the command

dumps out the protections and ownerships for all folders (and their subfolders) on the volume "OldVol". The dump takes the form of a sequence of commands that look like this:

Once I had created this dump, I simply needed to do a global search-and-replace, turning all occurrences of "OldVol:" to "NewVol:", then select the result and execute it, and voila! All the ownerships and protections were instantly transferred to the new disk!

Created by LDO 1997 August 8.

Back to MPW Intro