Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: delete messages massively

  1. #11
    Join Date
    Oct 2007
    Location
    Santa Rosa. CA
    Posts
    40
    Rep Power
    8

    Default

    I was able to get a list of message IDs based on a Subject search, but no messages were deleted when the search was scripted in with the "zmmailbox dm" command.

  2. #12
    Join Date
    Oct 2007
    Location
    Santa Rosa. CA
    Posts
    40
    Rep Power
    8

    Default Still not able to massively delete

    This script fails, delivering zmmailbox help:

    for i in 'zmmailbox -z -m admin@zimbra.scoe.org search "(Subject:Some Subject)" | grep conv | cut -d '-' -f 2 | cut -d ' ' -f 1'; do echo $i; zmmailbox -z -m admin@zimbra.scoe.org dm $i; done

    Would you correct my error so I can massively delete messages with a particular subject line?

  3. #13
    Join Date
    Jan 2012
    Posts
    41
    Rep Power
    3

    Default

    I have used a different syntax in my scripts, with sed and awk.

    Code:
    for i in `zmmailbox -z -m user search "Subject:Some subject" |  sed '1,4{d}' |  awk '{print $2;}' | sed 's/\-//g'`; do echo $i; zmmailbox -z -m user dm $i; done
    But for this to work 100%, you should provide for messages AND conversations.
    ID's with a (-) sign point to messages, whilst ID's with no (-) sign point to conversations.

    So, if you would like to delete both messages and conversations of a specific subject you should dm (deleteMessages) and dc (deleteConversations)

    Code:
    for i in `zmmailbox -z -m user search "Subject:Some Subject" |  sed '1,4{d}' |  awk '{print $2;}'`; do if [ $i -lt 0 ]; then j=`expr 0 - $i`;  echo "deleting message $j"; zmmailbox -z -m user dm $j; else echo "Deleting conversation $i"; zmmailbox -z -m user dc $i; fi; done
    Don't forget to use back quotes when defining variables. ` instead of '.
    Last edited by stasouv; 01-22-2012 at 07:57 AM. Reason: Misstyping.

  4. #14
    Join Date
    Oct 2007
    Location
    Santa Rosa. CA
    Posts
    40
    Rep Power
    8

    Default

    Thanks for the clarification, Stasouv.

Similar Threads

  1. [SOLVED] Re-creating the spam training e-mail account
    By richard-hdd in forum Administrators
    Replies: 21
    Last Post: 03-20-2012, 08:34 AM
  2. Delete all messages
    By norixam in forum Administrators
    Replies: 2
    Last Post: 01-07-2008, 07:05 AM
  3. Delete messages from store
    By claros in forum Administrators
    Replies: 2
    Last Post: 10-21-2006, 07:45 PM
  4. Spam assassain not traiing properly!
    By Mike T in forum Administrators
    Replies: 1
    Last Post: 10-09-2006, 02:34 PM
  5. Can't delete messages in Outlook Express
    By mond in forum Administrators
    Replies: 2
    Last Post: 10-05-2006, 03:01 AM

Posting Permissions

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