Compacting folders: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
(→‎How to compact folders: Compacting folders can take 20 minutes or more - important users are forwarned.)
m (lots of tidying)
Line 1: Line 1:
{{Tbsuite}}
{{Tbsuite}}


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 occur, so it's a good idea to do it periodically.
When you delete or move e-mails from a folder, Thunderbird and other e-mail programs simply hide them (and 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 are permanently removed only when the folder is ''compacted''. If you don’t compact your mail folders periodically then they can grow very large and erratic program behavior may occur.


Many new users never heard of compacting folders before and might confuse it with compressing files. It isn't some unique feature of Thunderbird. The main difference is that most other email clients by default automaticly compact the folder when a certain amount of space is wasted. Thunderbird doesn't.  
E-mail users have often never heard of compacting folders (not to be confused with compressing files). However, this approach to e-mail storage and deletion is common to most e-mail clients. The difference is that most other email clients by default automatically compact the folder when a certain amount of space is wasted; Thunderbird does not do this.  


==How to compact folders==
==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 from a few seconds to 20 minutes or more, 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".
To compact all folders in an account, click the account on the left, and then click "File -> Compact Folders". Compacting an account may take from a few seconds to 20 minutes or more, depending on how much mail you have and how recently you last compacted the folders. If you have trouble doing this and the process stalls, try compacting one folder at a time by right-clicking on the folder and choosing "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.
Try to avoid downloading e-mail while compacting folders, as it has been reported that this can cause corruption or a "[[folder being processed]]" error. For POP3 accounts, if [[Offline Support]] is installed, you should go offline before compacting folders. (To do this, go to "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===
===Other ways to compact folders===
Line 15: Line 15:
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.
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, you can have Thunderbird prompt you to compact folders when it will 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 via the [[User.js_file |user.js]] file or [[about:config]], even without Offline Support:
If [[Offline Support]] is installed, you can have Thunderbird prompt you to compact folders when it will 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 [[Editing configuration | set the following preferences]] to configure this feature, even without Offline Support:
  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);         //where "XXX" is the size threshold in 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 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]].
This will ask you for permission whenever it wants to compact the folder. (These two preferences only affect messages stored on your hard disk. If you have an 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.
''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.''


==Problems when compacting==
==Problems when compacting==
=== Compacting seems to take forever===


=== Compacting seems to take forever===
Usually it only takes a couple of minutes to compact your folders unless your profile is over a gigabyte in size or your computer is slow. The worst that normally happens if you exit Thunderbird before it finishes compacting is that it fails to delete some [[Nstmp_folders | nstmp temporary files]] that it created and you have to manually delete them.


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_folders | nstmp temporary files]] it created and you have to cleanup after it.
If compacting takes a long time, the status bar at the bottom of the window may not remove the text about it compacting a folder when it finishes. It may also fail to update that text to mention the last folder in that account if you use "File -> Compact Folders". If you do something else that normally displays some text in the status bar it should replace the message about compacting.


===Compacting doesn't seem to work===
===Compacting doesn’t seem to work===


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" (mail summary file) files are corrupted. To fix this problem:
If compacting folders doesn't seem to work even for a single folder (where you right-click on the folder and choose "Compact This Folder"), it is possible that the <tt>.msf</tt> mail summary files are corrupted. To fix this problem:
# Exit Thunderbird.
# Exit Thunderbird.
# Make a temporary [[Profile backup | backup]] copy of your [[profile folder]].
# Make a temporary [[Profile backup | backup]] copy of your [[profile folder]].
# 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".)
# In your profile folder, delete the files ending in <tt>.msf</tt>.  Thunderbird recreates them when it starts. (If you&rsquo;re using Windows and want a quick way to find all msf files in all subfolders too, just enter <tt>*.msf</tt> in Start->Search. On Windows XP, ensure that "Search hidden files" is chosen under "More advanced options"; on earlier versions of Windows, ensure that hidden files are viewable in Windows Explorer ("Tools -> Folder Options -> "View hidden files and folders").


If the problem persists and there is one particular folder (such as your Inbox) that fails to be compacted, you can try the following:
If the problem persists and there is one particular folder (such as your Inbox) that fails to be compacted, you can try the following:
# Exit Thunderbird and make a temporary [[Profile backup | backup]] copy of your [[profile folder]] so that you can revert everything easily if necessary.
# Exit Thunderbird and make a temporary [[Profile backup | backup]] copy of your [[profile folder]] so that you can revert everything easily if necessary.
# Start Thunderbird, create a new folder and name it "TestFolder" (or whatever).
# Start Thunderbird, create a new folder and name it "TestFolder" (or similar).
# 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").
# 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").
# Verify that all of the messages have been copied to TestFolder.
# Verify that all of the messages have been copied to TestFolder.
# Right-click on TestFolder and choose "Compact This Folder".
# Right-click on TestFolder and choose "Compact This Folder".
# 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.
# 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.
# If it looks like TestFolder can in fact be compacted successfully, exit Thunderbird, and go to your profile folder. Then:
# If it looks like TestFolder can in fact be compacted successfully, exit Thunderbird, and go to your profile folder. Then:
## Rename the file that was giving you problems (e.g., rename "Inbox" to "InboxOLD") and delete its ".msf" file (e.g., "Inbox.msf").
## Rename the file that was giving you problems (e.g. rename "Inbox" to "InboxOLD") and delete its <tt>.msf</tt> file (e.g. "Inbox.msf").
## 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".
## Rename the "TestFolder" folder to "Inbox" (or whatever the problematic folder was called) and delete "TestFolder.msf".
## 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".
## Restart Thunderbird, and use it as usual. If compacting folders seems to work correctly during a test period (such as one week) then you can delete the folder "InboxOLD".


==What if you don't compact folders?==
==What if you don&rsquo;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. [http://forums.mozillazine.org/viewtopic.php?t=85306][http://forums.mozillazine.org/viewtopic.php?t=76239][http://forums.mozillazine.org/viewtopic.php?t=84965] This wastes disk space, and when you [[Thunderbird : FAQs : Backing Up and Restoring | 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. [http://forums.mozillazine.org/viewtopic.php?t=100245]
 
* Messages that you have deleted or moved to other folders might strangely reappear where they shouldn't be. [http://forums.mozillazine.org/viewtopic.php?t=78881][http://forums.mozillazine.org/viewtopic.php?t=87443]
 
* Your [[Thunderbird : FAQs : Anti-virus Software | anti-virus software]] might detect infected messages that you long ago deleted, even if you emptied the Trash. [http://forums.mozillazine.org/viewtopic.php?p=687327#687327]
 
* It could cause problems when you try to defragment your hard disk. [http://forums.mozillazine.org/viewtopic.php?t=83198]


If you rarely or never compact folders, your mail files will accumulate more and more of the "hidden" messages that has been marked for permanent deletion but has not yet been removed. This can cause a lot of disk space to be used, and it can have a negative effect on Thunderbird&rsquo;s performance.
* Even if a mail folder seems to be empty or nearly empty, the mail file can become very large [http://forums.mozillazine.org/viewtopic.php?t=85306][http://forums.mozillazine.org/viewtopic.php?t=76239][http://forums.mozillazine.org/viewtopic.php?t=84965]. This wastes disk space, and when you [[Thunderbird : FAQs : Backing Up and Restoring | back up]] your mail files for safekeeping, you will waste time backing up all these "hidden" messages as well.
* When downloading messages, you might occasionally get duplicates of messages you&rsquo;ve already received [http://forums.mozillazine.org/viewtopic.php?t=100245].
* Messages that you have deleted or moved to other folders may unexpectedly reappear in theit original folder [http://forums.mozillazine.org/viewtopic.php?t=78881][http://forums.mozillazine.org/viewtopic.php?t=87443].
* Your [[Thunderbird : FAQs : Anti-virus Software | anti-virus software]] might detect infected messages that you long ago deleted, even if you emptied the Trash [http://forums.mozillazine.org/viewtopic.php?p=687327#687327].
* It could cause problems when you try to defragment your hard disk [http://forums.mozillazine.org/viewtopic.php?t=83198].
* Your [[Inbox stays blank|Inbox might stay blank]] for minutes.
* Your [[Inbox stays blank|Inbox might stay blank]] for minutes.
 
* The new message count could become much larger than the actual number of new messages. A quick fix is to delete the <tt>.msf</tt> mail summary file for that folder&mdash;Thunderbird will create a new one the next time you run it&mdash;but this will not work if the folder is badly corrupted.
* The new message count could become much larger than the actual number of new messages. A quick and dirty fix is to delete the .msf (mail summary file) file for that folder (Thunderbird will create a new one the next time you run it) but that won't work if the folder is badly corrupted.


== See also ==
== See also ==

Revision as of 15:43, 16 July 2006

This article was written for Thunderbird but also applies to Mozilla Suite / SeaMonkey (though some menu sequences may differ).

When you delete or move e-mails from a folder, Thunderbird and other e-mail programs simply hide them (and 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 are permanently removed only when the folder is compacted. If you don’t compact your mail folders periodically then they can grow very large and erratic program behavior may occur.

E-mail users have often never heard of compacting folders (not to be confused with compressing files). However, this approach to e-mail storage and deletion is common to most e-mail clients. The difference is that most other email clients by default automatically compact the folder when a certain amount of space is wasted; Thunderbird does not do this.

How to compact folders

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

Try to avoid downloading e-mail while compacting folders, as it has been reported that this can cause corruption or a "folder being processed" error. For POP3 accounts, if Offline Support is installed, you should go offline before compacting folders. (To do this, go to "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, you can have Thunderbird prompt you to compact folders when it will 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 set the following preferences to configure this feature, even without Offline Support:

user_pref("mail.prompt_purge_threshhold", true);
user_pref("mail.purge_threshhold", XXX);         //where "XXX" is the size threshold in kB

This will ask you for permission whenever it wants to compact the folder. (These two preferences only affect messages stored on your hard disk. If you have an IMAP account they will not compact your remote folders.)

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.

Problems when compacting

Compacting seems to take forever

Usually it only takes a couple of minutes to compact your folders unless your profile is over a gigabyte in size or your computer is slow. The worst that normally happens if you exit Thunderbird before it finishes compacting is that it fails to delete some nstmp temporary files that it created and you have to manually delete them.

If compacting takes a long time, the status bar at the bottom of the window may not remove the text about it compacting a folder when it finishes. It may also fail to update that text to mention the last folder in that account if you use "File -> Compact Folders". If you do something else that normally displays some text in the status bar it should replace the message about compacting.

Compacting doesn’t seem to work

If compacting folders doesn't seem to work even for a single folder (where you right-click on the folder and choose "Compact This Folder"), it is possible that the .msf mail summary 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. On Windows XP, ensure that "Search hidden files" is chosen under "More advanced options"; on earlier versions of Windows, ensure that hidden files are viewable in Windows Explorer ("Tools -> Folder Options -> "View hidden files and folders").

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 similar).
  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 "TestFolder" folder to "Inbox" (or whatever the problematic folder was called) and delete "TestFolder.msf".
    3. Restart Thunderbird, and use it as usual. If compacting folders seems to work correctly during a test period (such as one week) then you can delete the folder "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 that has been marked for permanent deletion but has not yet been removed. This can cause a lot of disk space to be used, and it can have a negative effect on Thunderbird’s 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 will 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 may unexpectedly reappear in theit original folder [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].
  • Your Inbox might stay blank for minutes.
  • The new message count could become much larger than the actual number of new messages. A quick fix is to delete the .msf mail summary file for that folder—Thunderbird will create a new one the next time you run it—but this will not work if the folder is badly corrupted.

See also

External links