MH & nmh: Email for Users & Programmers

May, 2006

Removing Folders: rmf

The rmf command removes a folder and all the messages in it. If you don't give a folder name, the current folder is removed.

CAUTION: If rmf can't find the current folder, for some reason, the folder to be removed defaults to inbox. If you have an Inbox: MH profile entry (MH 6.8 and above), rmf will default to that folder instead.

In the following cases, rmf removes a folder and all messages and does not ask for confirmation:

At other times, rmf is supposed to ask for confirmation before it removes a folder.
CAUTION: When you use the rmf command, the folder, and the messages in it, are completely removed -- you can't get them back.

rmf does not use the rmmproc:, if any, in your MH profile. Be careful.

I recommend that you put this entry in your MH profile:

    rmf: -interactive
    
That should help to ensure that rmf always shows you the folder name and asks for confirmation before deleting it. (You should spell -interactive correctly; it doesn't have the spelling bug mentioned above.)

After you remove a top-level folder, rmf will set the current folder to inbox. After you remove a subfolder, rmf will set the current folder to that folder's parent. This is shown in the following example:

    % folder
            do/re/mi+ has   8 messages (   1-  15); cur=  7.
    % rmf
    Remove folder "do/re/mi"? y
    [+do/re now current]
    
If you try to remove a folder which has subfolders or any other non-MH files in it, rmf won't remove them -- it will complain and abort without removing the folder. But, before it aborts, it can remove the messages in the folder! Again, be careful with rmf.

The rmf command is also used to remove your reference to a read-only folder. See the Section Sharing Other Users' Folders.