ZIMBRA: Total folders/messages for an account.

Leave a comment

July 19, 2017 by aubreykloppers

This is a reoccurring question I keep asking, how to get the total folders and the total messages for a user?

After some searching, I do believe I found the answers:

Total Folders for a user:

zmmailbox -z -m [USER] getAllFolders | \
wc | awk '{printf "Total folders: " $1 "\n"}'

Total mail for a user:

for j in [user]; do total=0; \
echo -n "Total for $j = "; \
for i in $( zmmailbox -z -m "$j" gaf | \
awk '{print $4}' | \
egrep -o "[0-9]+" ); \
do total=$(( total + i )); \
done; \
echo "$total"; \
done
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: