Parsing mailboxes

C

cmika

Problem: Mozilla mailbox is way to big (800MBs).
Solution: Split it up.

#!/usr/bin/perl

############
# Splits Mozilla style Inboxes into smaller ones (max size = maxMailboxSize)
# use: ./splitMozilla <mailbox name>
# output: mailbox0 [mailbox1] [mailbox2] ...
############

$maxMailboxSize = 104857600;
$mailboxNumber = 0;
open OUTPUTFILE, ">mailbox$mailboxNumber";

while(<>) {
if(/^From /) {
if((stat(OUTPUTFILE))[7] > $maxMailboxSize) {
close OUTPUTFILE;
$mailboxNumber ++;
open OUTPUTFILE, ">Inbox$mailboxNumber";
}
}
print OUTPUTFILE $_;
}

Problem: It's not working. It's creating mailbox0, writes about 1.9MBs, then
the system runs out of memory, which shouldn't happen. What I'm basically
trying to do is search for a new message, check if the outputfile is over
100MBs, if it is, create a new one, if it's not, then write the message to
outputfile. Any ideas?

-Chris Mika
(e-mail address removed)
 
S

Steve Bennett

Have you taken into consideration the summary file?
This is from my netscape knowledge but I assume mozilla is the same.
If you change a mail folder you have to first kill netscape (mozilla)
delete the coresponding .summary file and let netscape (mozilla)
re-create
the summary file when it starts again.
The summary files are hidden use ls -al to see them. (in the unix world)

-s
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top