Results 1 to 7 of 7

Thread: Delete all folders/messages after imapsync test run

  1. #1
    Join Date
    Apr 2010
    Posts
    24
    Rep Power
    5

    Default Delete all folders/messages after imapsync test run

    Hi

    Our company is going to migriate to zimbra open source version.
    Everything seems to be working fine. Imapsync works great.

    Is there anyway to empty all mailboxes currently on the server ? As we did a test run with some users, but still there will be some weeks before we are ready to migriate. I know i can empty folders with the following command :

    zmmailbox -z -m account@domain.com emptyFolder "foldername" or

    zmmailbox -z -m account@domain.com df "foldername"

    Anyway to do this without having to know the folder names ? Iguess deleting the account and adding it again would solve it, but i would rather not do that as that would mean a lot of work configuring the accounts/shares again.

  2. #2
    Join Date
    Jul 2007
    Location
    Baltimore
    Posts
    1,649
    Rep Power
    11

    Default

    probably the easiest way would be to run a script to call zmmailbox getAllFolders for the account. you'd have to parse the output to get the last column which is the foldername, and you should probably parse that even to only get top level folders to save time.

  3. #3
    Join Date
    Apr 2010
    Posts
    24
    Rep Power
    5

    Default

    Got it working with a perl script i wrote up.

    Basically what it does is :

    read a input file with the usernames, sends gaf command to zmmailbox with the user name. Save the output to a file, then parse this file save path to a new file wich contains appopriate zmmailbox commands. Make this file excutable and run it ;P

    Script is not perfect but gets the job done. Thx for the pointer.

  4. #4
    Join Date
    Apr 2011
    Posts
    14
    Rep Power
    4

    Default

    Would you like to share your script? I have exactly the same issue and wish to delete all mail without deleting the account ? thanks

  5. #5
    Join Date
    Apr 2010
    Posts
    24
    Rep Power
    5

    Default script

    I can post it, here it is :

    tombruker.zip

    Im no pro scripter so use at own risk, but at least it worked for me.

    Execute script : perl scriptname.pl inputfile

    inputfile has following format :

    Username1
    Username2
    Username3
    etc

    Would advise you to remove any blank lines, from the outputfile ones the script has finished (open with vim, then use ":sort u" command). Also make the output file executable (chmod+x), ones you execute it there is no turning back..
    Last edited by berjos; 04-26-2011 at 01:00 AM.

  6. #6
    Join Date
    Apr 2011
    Posts
    14
    Rep Power
    4

    Default

    thanks for that.. Much appreciated. I will give it a whirl

  7. #7
    Join Date
    Apr 2010
    Posts
    24
    Rep Power
    5

    Default

    Happy to help Would be nice with a reply if it works for you or not.

Similar Threads

  1. [SOLVED] ldap errors on zimbra start
    By jimbo in forum Administrators
    Replies: 1
    Last Post: 01-14-2008, 08:51 AM
  2. 4.0 RC1 imapsync with admin???
    By kirme3 in forum Administrators
    Replies: 37
    Last Post: 07-19-2007, 09:52 AM
  3. imapsync "out of memory"
    By EFSNetworks in forum Administrators
    Replies: 9
    Last Post: 10-13-2006, 01:51 PM
  4. imapsync and mail filters
    By Coilcore in forum Administrators
    Replies: 5
    Last Post: 08-10-2006, 08:21 AM
  5. antispam not working?
    By moebis in forum Installation
    Replies: 16
    Last Post: 12-03-2005, 07:11 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
  •