Windows 10 will reach EOS (end of support) on October 14, 2025. For more information, see this article.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Compact folders fails on occasion

  • 4 replies
  • 0 have this problem
  • 5 views
  • Paskiausią atsakymą parašė Mark Lang

more options

Since the error appeared that disabled the xPunge plugin (around TB 140), I have been compacting the folders in my 4 Thunderbird mail accounts manually. I wish there was a better way, but unfortunately not at this time. When I select to Empty Trash, I get messages showing quite an extensive dialog. It logs in, syncs, and even checks the folder capability of the server. When I select to Compact Files, I first get a simple message in the lower left corner "Compacting Files." Then I get messages showing each folder being compacted, and how much space was saved. It even shows reloading the last message at the end, even though the message is already there.

Since I now see this detailed dialog, I have noticed that, from time to time, the compacting fails. I get the first message, "Compacting Folders." But then nothing else. I also don't see the email message list go blank for a second when it is compacting the folder I am viewing. If I repeat the compacting folder command, it does the same thing. It appears that TB thinks the folders are already compacted, and takes no action. The only way I have found to get the compacting to work is to wait for more messages to come, delete the ones I don't want, and it will probably work on the next try. It seems to fail perhaps every 10th time or so.

Perhaps this is the same TB base code issue that is affecting xPunge? I do not get any errors, at least that I can recognize. I looked at the console, but I could not discern anything there that might be applicable - but that could be because I don't understand most of the messages there. Is there anything I can do to get around this issue? Thanks.

Since the error appeared that disabled the xPunge plugin (around TB 140), I have been compacting the folders in my 4 Thunderbird mail accounts manually. I wish there was a better way, but unfortunately not at this time. When I select to Empty Trash, I get messages showing quite an extensive dialog. It logs in, syncs, and even checks the folder capability of the server. When I select to Compact Files, I first get a simple message in the lower left corner "Compacting Files." Then I get messages showing each folder being compacted, and how much space was saved. It even shows reloading the last message at the end, even though the message is already there. Since I now see this detailed dialog, I have noticed that, from time to time, the compacting fails. I get the first message, "Compacting Folders." But then nothing else. I also don't see the email message list go blank for a second when it is compacting the folder I am viewing. If I repeat the compacting folder command, it does the same thing. It appears that TB thinks the folders are already compacted, and takes no action. The only way I have found to get the compacting to work is to wait for more messages to come, delete the ones I don't want, and it will probably work on the next try. It seems to fail perhaps every 10th time or so. Perhaps this is the same TB base code issue that is affecting xPunge? I do not get any errors, at least that I can recognize. I looked at the console, but I could not discern anything there that might be applicable - but that could be because I don't understand most of the messages there. Is there anything I can do to get around this issue? Thanks.

All Replies (4)

more options

I have to ask why? I have used Thunderbird for may years going back to version 2. I have never needed anything more complex than Thunderbird's built in automatic compact when it will free more than XX space and empty trash on Exit.

I get so little actual spam that if I look there once a month I still only have a dozen or so email and I do like to look at them before they leave permanently. I just can not bring myself to trust a computer algorithm to decide what I see and what I do not without some oversight.

more options

I guess people have different requirements and styles. I get quite a bit of spam, but also many newsletters and the like that take up megabytes of space in my mail folders if I don't compact them regularly. I usually compact several times in the morning, for example, with 6-8 MB saved each time. I also back up the mail files regularly, and I like to keep those backups as small as possible. That includes a direct email backup using MailStore Home, which searches the folders directly so will recover deleted emails if the files have not been compacted. For so long it was so easy to just run xPunge. Now it takes much more effort, but I still compact my folders after an account has received a number of emails that have been deleted.

more options

As far as I can tell Xpunge compacts all folders - this is a function already available in Thunderbird. In addition, Xpunge will empty the Trash, Thunderbird can be set up to auto do that on Exit. It can be set up to empty Junk - (with a use with care warning) - Thunderbird does offer an auto delete junk older than x days. In addition, many servers auto empty Trash and Junk periodically anyway which is helpful in IMAP accounts.

I'm including various information etc because this might be read by any one accessing this question for information and help.

Compact options in Thunderbird. Auto compact all folders in all accounts when it will save a set amount of space.

  • Settings > General
  • scroll down to 'Disc Space' section
  • Select checkbox: 'Compact all folders when it will save over x MB'
  • Select checkbox 'Ask every time before compacting' - then you will know it's occuring and can therefore not select any folder or email nor Exit Thunderbird whilst it completes the task.

To compact only the folders within the currently selected account. Manually Via Menu Bar toolbar

  • File > Compact folders

Manually Compact a specific folder:

  • Right click on a folder and select 'Compact'


re :recover deleted emails if the files have not been compacted. This can be done manually if required.

  • Exit Thunderbird first.

Example for 'Inbox' When you delete or move emails from a folder, the original remains in the file and the 'X-Mozilla-Status:' is set to display a number 9 as the last digit of 4 eg: 0009 Any mbox file can be opened using text editor eg: Notepad++

Access profile folders and select the relevant mail account folder.

  • Right click on 'Inbox' no extension mbox file and select to open with Notepad++
  • 'Edit' > 'Find' on X-Mozilla-Status:
  • For any email ending in 9 , edit the number to say '0001'
  • Check through all of file and then save the file.
  • Delete the relevant index file eg: 'Inbox.msf'


Manual Backup: This assumes you have got an installation of Thunderbird from the official website as a installation from the Windows app store is more complex. https://www.thunderbird.net/en-US/thunderbird/all/

It's manual but very quick: This backs up everything - profiles.ini, profile name folders, preferences, mail accounts, emails, address books, calendar etc.

  • Exit Thunderbird
  • In Windows search type: %Appdata% - see image below
  • Select '%Appdata% file folder
  • Select 'Roaming' folder
  • Copy the 'Thunderbird' folder to a suitable location
eg: D:drive or external disk drive. I would advise you do not use Onedrive as that is saving on an external server and is reliant upon you having access to Microsoft account and password. Not funny if you ever get locked out of account.
more options

Thanks for this comprehensive explanation of options. As to Xpunge, it has not worked with any version of Thunderbird since 140 forward. That is what I have used for years, and wish I could still use since I have four IMAP accounts that I manage with TB. There is some bug in the TB code that causes Xpunge to fail which has not been fixed. The author of Xpunge filed a detailed bug report some time ago. There is a workaround one can use to get Xpunge to load by modifying the xpi file, but it still has the bug. The second option, File > Compact folders, is what I was addressing in this thread. It also seems to fail intermittently. Perhaps it is caused by the same bug as the one that impacts Xpunge. I just know that, from time to time, the compact folders takes no action when there are folders that need compacting. I have not found any way to distinguish when the failure will occur except to run the Compact Folders and see in the messages that no folders were actually compacted when I know I have deleted messages in the folders. I suppose the option to compact when it will save x space works for many users. In my case, I prefer to take action manually so I always know where I stand. I am not sure what would happen if I exited TB when something like compacting folders was in progress.

The backup option for the profile in the Roaming folder is a great one that I do use regularly. I use it mostly to restore to a working profile when there are problems or corruptions. MailStore Home is a great free program that archives individual emails and lets you search for and access individual emails when you need to. I like to have that as an additional option. Unfortunately, it takes emails directly from the mbox file, but it does not recognize the X-Mozilla-Status: parameter you mention. So, it will archive any email that has been deleted when the folder has not been compacted. MailStore Home does provide an option to archive directly from the IMAP server instead. However, it is limited to a couple of accounts (not 4 like I have).

Thanks again. I am still a big fan of Thunderbird and the support provided by the community.

Užduoti klausimą

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.