Created
June 28, 2013 20:24
-
-
Save greencm/5887815 to your computer and use it in GitHub Desktop.
Count the number of messages in an mbox file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# $Id$ | |
# Author: <[email protected]> | |
# Purpose: Count the number of mails in an mbox file | |
# Created: Fri Jun 28 10:39:13 CDT 2013 | |
import sys | |
from mailbox import mbox | |
import re | |
def count_mbox(box): | |
i = 0 | |
for n, msg in box.iteritems(): | |
i+=1 | |
return i | |
if __name__=='__main__': | |
for f in sys.argv[1:]: | |
print f, count_mbox(mbox(f)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment