Compacting folders: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
Line 15: Line 15:
  user_pref("mail.prompt_purge_threshhold", true);
  user_pref("mail.prompt_purge_threshhold", true);
  user_pref("mail.purge_threshhold", XXX); "XXX" Value for kB
  user_pref("mail.purge_threshhold", XXX); "XXX" Value for kB
Note: Those two preferences only effect messages stored on your hard disk. If you have a IMAP account they will not compact your remote folders.


===Problems compacting folders?===
===Problems compacting folders?===

Revision as of 19:06, 9 September 2005

This article was written for Thunderbird but also applies to Mozilla Suite (though some menus may be slightly different).

When you delete or move e-mails from a folder, Thunderbird and other e-mail programs really only "hide" them (i.e., mark them as ready for permanent deletion), and these hidden e-mails still actually remain in the folder. Even emptying the Trash does not permanently delete them. These hidden e-mails remain in the folder until it is compacted. If you don't compact folders, your mail folders can grow very large and erratic program behavior can occur (see below), so it's a good idea to do it periodically.

How to compact folders

To compact all folders in an account: click on the account on the left, and then click "File -> Compact Folders". Compacting an account may take a few seconds or a few minutes, depending on how much mail you have and how recently you've compacted folders. If you have trouble doing this and the process stalls, try compacting one folder at a time: right-click on the folder and choose "Compact This Folder".

Note: try to avoid downloading e-mail while compacting folders, as it's been reported that this can cause corruption or a "folder being processed" error. For POP3 accounts: if Offline Support is installed, first go offline ("File -> Offline -> Work Offline", or simply click on the icon in the bottom left corner). For IMAP accounts: you cannot compact folders unless you are online.

Other ways to compact folders

For IMAP accounts, Thunderbird can automatically compact the Inbox when you exit: click "Tools -> Account Settings -> [account name] Server Settings", and check "Clean up ('Expunge') Inbox on Exit." If you check "Empty Trash on Exit" it will empty and compact the Trash folder when you exit.

If Offline Support is installed, Thunderbird can notify you when compacting would save a certain amount of disk space. Go to "File -> Offline -> Offline Settings", and check "Compact folders when it will save over ___ KB". Advanced users can configure this feature in the "user.js" file, even without Offline Support:

user_pref("mail.prompt_purge_threshhold", true);
user_pref("mail.purge_threshhold", XXX); "XXX" Value for kB

Note: Those two preferences only effect messages stored on your hard disk. If you have a IMAP account they will not compact your remote folders.

Problems compacting folders?

If compacting folders doesn't seem to work even for a single folder (if you right-click on the folder and choose "Compact This Folder"), it's possible that the ".msf" files (index files) are corrupted. To fix this problem:

  1. Exit Thunderbird.
  2. Make a temporary backup copy of your profile folder.
  3. In your profile folder, delete the files ending in ".msf". Thunderbird recreates them when it starts. (If you're using Windows and want a quick way to find all msf files in all subfolders too, just enter *.msf in Start->Search. Make sure "Search hidden files" is chosen under "More advanced options".)

If the problem persists and there is one particular folder (such as your Inbox) that fails to be compacted, you can try the following:

  1. Exit Thunderbird and make a temporary backup copy of your profile folder so that you can revert everything easily if necessary.
  2. Start Thunderbird, create a new folder and name it "TestFolder" (or whatever).
  3. In the folder that is giving you problems (e.g., Inbox), select all the messages and copy them to TestFolder ("Message -> Copy" -> [account name] -> TestFolder").
  4. Verify that all of the messages have been copied to TestFolder.
  5. Right-click on TestFolder and choose "Compact This Folder".
  6. Go to your profile folder and see if TestFolder looks like it has been compacted. It should be significantly smaller in size than the folder from which you copied the messages.
  7. If it looks like TestFolder can in fact be compacted successfully, exit Thunderbird, and go to your profile folder. Then:
    1. Rename the file that was giving you problems (e.g., rename "Inbox" to "InboxOLD") and delete its ".msf" file (e.g., "Inbox.msf").
    2. Rename the file "TestFolder" (or whatever you called it) to "Inbox" (or whatever the problem file was called) and delete "TestFolder.msf". When you restart Thunderbird, "TestFolder" will be your new "Inbox", and the problem file will show up as "InboxOLD".
    3. Restart Thunderbird. Use it as usual. If compacting folders seems to work OK during a test period (e.g., one week), then you can delete "InboxOLD".

What if you don't compact folders?

If you rarely or never compact folders, your mail files will accumulate more and more of the "hidden" messages (see the first section, above). This can have negative effects with regard to disk space and Thunderbird performance:

  • Even if a mail folder seems to be empty or nearly empty, the mail file can become very large. [1][2][3] This wastes disk space, and when you back up your mail files for safekeeping, you'll waste time backing up all these "hidden" messages as well.
  • When downloading messages, you might occasionally get duplicates of messages you've already received. [4]
  • Messages that you have deleted or moved to other folders might strangely reappear where they shouldn't be. [5][6]
  • Your anti-virus software might detect infected messages that you long ago deleted, even if you emptied the Trash. [7]
  • It could cause problems when you try to defragment your hard disk. [8]