Compacting folders: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
(added reference to automsgselect extension)
Line 10: Line 10:


===Other ways to compact folders===
===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.
For IMAP accounts, Thunderbird can automatically compact the Inbox when you exit: click "[[Menu differences in Windows, Linux, and Mac|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 |user.js]]" file, even without Offline Support:
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 |user.js]]" file, even without Offline Support:
Line 16: Line 16:
  user_pref("mail.purge_threshhold", XXX); "XXX" Value for kB
  user_pref("mail.purge_threshhold", XXX); "XXX" Value for kB


This will ask you for permission whenever it wants to compact the folder. You can use the [http://www.extensionsmirror.nl/index.php?showtopic=4126 AutoMsgSelect extension] to automaticly press the OK button for you, so that the dialog box just flashes on the screen and then disappears.
This will ask you for permission whenever it wants to compact the folder. You can use the [http://www.extensionsmirror.nl/index.php?showtopic=4126 AutoMsgSelect extension] to automatically press the "OK" button for you, so that the dialog box just flashes on the screen and then disappears. Instructions on how to install a Thunderbird extension are available [[Extensions (Thunderbird) | here]].
   
   
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.
Note: Those two preferences only affect messages stored on your hard disk. If you have an IMAP account they will not compact your remote folders.


=== Does it seem to compact the folders forever?===
=== Does it seem to compact the folders forever?===

Revision as of 05:54, 26 December 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

This will ask you for permission whenever it wants to compact the folder. You can use the AutoMsgSelect extension to automatically press the "OK" button for you, so that the dialog box just flashes on the screen and then disappears. Instructions on how to install a Thunderbird extension are available here.

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

Does it seem to compact the folders forever?

The status bar at the bottom of the window doesn't always erase the text about it compacting a folder when it finishes. It also doesn't always update that text to mention the last folder in that account if you use File -> Compact Folders. Usually it only takes a couple of minutes to compact your folders unless your profile is over a gigabyte or your computer is slow. If you do something else that normally displays some text in the status bar it should replace the message about compacting. The worst that normally happens if you exit Thunderbird before it finishes compacting is it doesn't delete some nstmp temporary files it created and you have to cleanup after it.

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]

See also

Why do I have nstmp folders?