Results 1 to 2 of 2

Thread: Export Mailbox Size to CSV

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Rep Power

    Lightbulb Export Mailbox Size to CSV

    I wrote a bash script to get mailbox size of all mailboxes and export it to csv. Hopefully someone finds this useful.

    I would post it to the wiki put when I created by wiki account I didn't see a create page link.

    #This script exports email address & mailbox size in MB to csv for all accounts
    #It was tested against a single domain setup
    #For 125 accounts and 300GB total volume size it took about 5 minutes
    #By James Barnett
    cd /home/zimbra;
    echo "This will take a few minutes ..."
    zmprov gaa > temp.txt; #export a list all accounts to a temp file
    rm -f size.csv #remove the any pervious CSV file
    echo -n "Email Address, " >> size.csv 
    echo "Size of Mailbox in MB" >> size.csv #echo column headers to the CSV file
    for i in $(cat temp.txt); #loop through the accounts
         echo -n "$i, "  >> size.csv; #echo the email address
         bytes=$(zmmailbox -z -m $i getmailboxsize -v) #get mailbox size in bytes and set to variable
         echo "scale=2; $bytes/1048576" | bc>> size.csv #return mailbox size in MB
    rm -f temp.txt #remove temp file
    echo "Finished! Check /home/zimbra/size.csv for results"
    echo -e "\a" #Ring the system bell to let the user know the report is ready

  2. #2
    Join Date
    Mar 2012
    Rep Power


    Oldie, but useful for me today, modified a little cause i just needed specific people, but lots of help


Similar Threads

  1. [SOLVED] my server stopped working???
    By cecil in forum Administrators
    Replies: 4
    Last Post: 04-20-2008, 08:07 AM
  2. installation error during ldap setup
    By ljramos in forum Installation
    Replies: 23
    Last Post: 08-10-2007, 10:48 PM
  3. unable to restart zimbra after reboot
    By droefs in forum Administrators
    Replies: 28
    Last Post: 04-16-2006, 02:33 PM
  4. Replies: 16
    Last Post: 01-05-2006, 08:55 AM
  5. After Succesfull Install, Cannot Start mta
    By bsimzer in forum Installation
    Replies: 26
    Last Post: 12-16-2005, 04:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts