Thunderbird creates a temporary file called "nstmp" when it's compacting a folder. If Thunderbird is interrupted during the compacting, it will abort, and the temporary file will not be deleted. If the problem occurs multiple times, you'll see numbered files ("nstmp1", "nstmp2", etc.).
Shutting the program down during the compacting process, whether intentionally or due to a crash, will interrupt the process. Receiving a new message in the folder you're compacting will also interrupt the process. You can avoid the problem by switching to working offline ("File -> Offline -> Work Offline") before you compact a folder, but thats a nuisance. Usually you can prevent this problem by keeping your inbox as empty as possible (store messages in other folders/child folders) and setting "Tools -> Options -> Advanced -> Network & Disk Space -> Disk Space -> Compact disk space when it will save over" to a lower value.
Check to see which folder the nstmp folder is duplicating, and check that the original folder is okay (e.g. compare number of messages in "View -> Toolbars -> Status Bar"). If so, you can delete the "nstmp" folder(s) by right-clicking it and choosing "Delete Folder" (or by deleting the files in your profile).
- Thunderbird creates the "nstmp" file in the same directory as the folder it's compacting, and then renames it. This means it's possible that you might not be able to compact a large folder because you don't have enough free disk space. If this occurs, try compacting some smaller folders one by one to free up enough space.
- A few users report a "nstmp" folder if they delete some messages, click "File -> Empty Trash" , the Trash folder for some unknown reason is no longer displayed and they compact the folders. This problem occurs regardless of whether they're offline or not. However, if they exit Thunderbird, restart it, and the Trash folder is displayed again in the folder pane they can compact the folder with no ill side-effects.