# Changing MH Directory Name

By default, MH names your mail directory Mail (note the capital M) and puts it under your home directory. You can actually name this directory anything and put it anywhere on the filesystem. (It doesn't have to be in or under your home directory, but it should be someplace that you have permission to create new files and write.) For instance, you can "hide" the MH mail directory by putting a period (`.`) before its name. This means it won't clutter an ls listing of your home directory (unless you use ls -a, of course).

To change the name, change the `Path:` entry in your MH profile. By default, your MH directory name is Mail. So you should have this single `Path:` entry:

        Path: Mail

If your MH directory doesn't exist yet, MH will see your `Path:` and create it in the right place when you run your first MH command. If the directory already exists and you change the `Path:`, you'll need to move your directory. (If you're changing the directory name but not the location in the filesystem, you can use a command like `mv oldname newname`. If you want to move the directory someplace else, such as a subdirectory, you may need a command like tar to move your directory and preserve any links you've made.)

Here are rules for locating your MH directory. For this example, let's see what a user named Walt could do. His home directory is /u/walt.

- If the MH directory name does not start with a slash (`/`), like .Mail, it must be in the home directory:

            Path: .Mail

  In this example, the exact location of Walt's directory would be /u/walt/.Mail.
- The directory can be put someplace underneath the home directory (in a sub-subdirectory of the home directory) by using slashes (`/`) to separate the levels. For instance, Walt could put his MH directory in /u/walt/files/mh with the following `Path:` entry:

            Path: files/mh

- To put the directory someplace completely different (not under the home directory), use a full pathname starting with a slash (`/`). For example, let's say that Walt has several different accounts on the same computer (or on different computers, with a networked filesystem that's shared by all the computers) and has set up his /u/walt account to allow writing by his other accounts. The home directories might be called /u/walt, /u/project, and /u/share/walter. If Walt wants to keep all his mail in the /u/walt/Mail directory, he would put this `Path:` entry in his /u/project/.mh_profile and /u/share/walter/.mh_profile files:

            Path: /u/walt/Mail

  and this entry in his /u/walt/.mh_profile file:

            Path: Mail

  No matter what account he's logged on to, if he types a command like:

            % folder +inbox
                     inbox+ has 124 messages (  12- 198); cur= 19.

  it will use the inbox folder in his /u/walt/Mail directory. When he types `inc`, the mail will go from his current account into that same inbox. (Each individual mail message file will still be owned by the account which created it. The group ownership will be set to the group which owns the folder. But, if the access permissions are set correctly -- in the `Msg-protect:` entry in .mh_profile -- this shouldn't be a problem. If Walt's machine has disk quotas, though, Walt should be sure that the other accounts will be allowed to make files on the filesystem which holds /u/walt.)

  If there's a chance that more than one of the accounts will be used at the same time, Walt should think about putting the following two entries in each account's .mh_profile file:

            context: context.username
            mh-sequences:

  The first entry sets a different MH context file for each username. (Those filenames aren't required. Files named context.1, context.2,... would be fine.) The empty second entry means that all sequences will be private -- that is, stored in the user's context file instead of in the folder. Both of those make conflicts between accounts less likely, though they will add some overhead.

One problem with putting your MH directory on another filesystem is that the link named `@` which repl makes can't be created from a different filesystem. There's a C shell alias below that checks your current directory as you run repl. If you aren't on the same filesystem as the MH directory, the alias uses the C shell pushd command to push the MH directory onto your directory stack. After you've replied, you can popd back to your previous directory. (Many Bourne-type shells don't have directory stacks. You could adapt this alias to use a shell function and a shell variable to save your old directory location.)

        alias repl 'if ($cwd !~ /u/*) pushd /u/walt; \repl'

(That alias uses a simple-minded test: it checks the name of the first-level directory. If the filesystem with your MH directory has more than one top-level directory, the alias will use pushd more often than it needs to. You might want to use a more sophisticated test.)

Let's say that Walt installs that alias; his MH directory is under /u/walt. He wants to reply to a message while his current directory is /usr/local/system, which isn't on the /u filesystem:

        % repl -noanno 23
        /u/walt /usr/local/system
           ...Walt replies...
        % popd
        /usr/local/system