/opt/zimbra/bin/zmmailbox -z -m user@corp.org gaf # gaf - getAllFolders
Id View Unread Msg Count Path ---------- ---- ---------- ---------- ---------- 1 unkn 0 0 / 16 docu 0 15 /Briefcase 10 appo 0 52 /Calendar 14 mess 0 1564 /Chats 7 cont 0 7 /Contacts 6 mess 0 56 /Drafts 13 cont 0 179 /Emailed Contacts 2 mess 0 5352 /Inbox 65450 mess 0 12433 /Inbox/ 1.04.2015 31907 mess 0 3125 /Inbox/ 5993 mess 0 881 /Inbox/ 4 mess 0 0 /Junk 5 mess 0 7527 /Sent 15 task 0 8 /Tasks 3 unkn 0 0 /Trash 1770 mess 7 7 /Trash/. (support@corp.org:703) 3741 docu 0 1 / 87195 docu 0 1 / 1015 docu 0 12 / 663 cont 0 1 / 290 task 0 2 / 1100 mess 4404 22301 /. - (support@corp.org:2)
/opt/zimbra/bin/zmmailbox -z -m user@corp.org gaf | grep mess
Id View Unread Msg Count Path ---------- ---- ---------- ---------- ---------- 14 mess 0 1564 /Chats 6 mess 0 56 /Drafts 2 mess 0 5352 /Inbox 65450 mess 0 12433 /Inbox/ 1.04.2015 31907 mess 0 3125 /Inbox/ 5993 mess 0 881 /Inbox/ 4 mess 0 0 /Junk 5 mess 0 7527 /Sent 1770 mess 7 7 /Trash/. (support@corp.org:703) 1100 mess 4404 22301 /. - (support@corp.org:2)
/opt/zimbra/bin/zmmailbox -z -m user@corp.org gaf | grep mess | cut -d"/" -f 2- | grep -v "@corp.org"
Chats
Drafts
Inbox
Inbox / until 1.04.2015
Inbox / Marketing
Inbox / Eureka
Junk
Sent
/opt/zimbra/bin/zmmailbox -z -m user@corp.org s -l 300 in:Inbox/ | grep `date -d '-5 day' +%m/%d/%y` | grep "" | sed -e "s/^\s\s*//" | sed -e "s/\s\s*/ /g"
/opt/zimbra/bin/zmmailbox -z -m user@corp.org s -l 300 in:Inbox/ | grep `date -d '-5 day' +%m/%d/%y` | grep "" | sed -e "s/^\s\s*//" | sed -e "s/\s\s*/ /g"
ERROR: mail.NO_SUCH_FOLDER (no such folder path: /Inbox/\)
/opt/zimbra/bin/zmmailbox -z -m user@corp.org s -l 300 in:"\"Inbox/ "\"
/opt/zimbra/bin/zmmailbox -z -m user@corp.org gaf | grep mess | cut -d"/" -f 2- | grep -v "@corp.org" > /tmp/messfolder.list
/opt/zimbra/bin/zmmailbox -z -m $is -l 300 in:"\"$p"\" | grep `date -d '-5 day' +%m/%d/%y` | grep "" | sed -e "s/^\s\s*//" | sed -e "s/\s\s*/ /g" |
ERROR: mail.NO_SUCH_FOLDER (no such folder path: /Inbox/\)
#!/bin/bash DOMAIN_NAME="corp.org" # EMAIL=/tmp/email.list # MESID=/tmp/mesid.list # ID DELTEXT='' # IFS=$'\n' # before="$(date +%s)" # t=0 # , /opt/zimbra/bin/zmprov -l gaa $DOMAIN_NAME | sort > $EMAIL # # for i in $(cat $EMAIL); do echo $i # , , , - , , mess /opt/zimbra/bin/zmmailbox -z -m $i gaf | grep mess | cut -d"/" -f 2- | grep -v "@corp.org" > /tmp/messfolder.list # , id . . for p in $(cat /tmp/messfolder.list); do echo $p # : grep , grep , grep , sed' cut , . /opt/zimbra/bin/zmmailbox -z -m $is -l 300 in:"\"$p"\" | grep `date -d '-5 day' +%m/%d/%y` | grep "$DELTEXT" | sed -e "s/^\s\s*//" | sed -e "s/\s\s*/ /g" | cut -d" " -f2 > $MESID # - . cat $MESID count=`grep '' $MESID -c` let t=$t+$count for a in $(cat $MESID | grep ^- | sed s/-//g ) do /opt/zimbra/bin/zmmailbox -z -m $i deleteMessage $a done for a in $(cat $MESID | sed /-/d) do /opt/zimbra/bin/zmmailbox -z -m $i deleteConversation $a done echo -n > $MESID RES=$? if [ "$RES" == "0" ]; then echo "[Ok]"; else echo "[Err]"; fi done echo " : "$t done after="$(date +%s)" elapsed="$(expr $after - $before)" hours=$(($elapsed / 3600)) elapsed=$(($elapsed - $hours * 3600)) minutes=$(($elapsed / 60)) seconds=$(($elapsed - $minutes * 60)) echo " : $hours $minutes $seconds " echo " : "$t" "
Source: https://habr.com/ru/post/277117/
All Articles