This shows you how to create a folder in a mailbox, then move all emails larger than a certain size to that folder.

First, you need to su – zimbra.

Second, set up your account, folder and search settings:

$ mailbox=user@domain.com
$ bigsize=1MB
$ bigfolder=/BIG

Create the folder:

$ zmmailbox -z -m "user@domain.com" cf $bigfolder

To test to see a list of messages that will be moved:

$ zmmailbox -z -m "$mailbox" search -t message "larger:$bigsize"

Then to actually move those messages:

$ zmmailbox -z -m "$mailbox" moveMessage `zmmailbox -z -m "$mailbox" search -t message "larger:$bigsize" | grep ^[0-9] | awk '{ printf("%s,",$2) }' | sed "s/,$//g"` $bigfolder