Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-03-2010, 04:37 AM
Intermediate Member
 
Posts: 21
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.
Reply With Quote
  #2 (permalink)  
Old 11-03-2010, 06:15 AM
Moderator
 
Posts: 1,554
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.
Reply With Quote
  #3 (permalink)  
Old 11-03-2010, 08:27 AM
Intermediate Member
 
Posts: 21
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.
Reply With Quote
  #4 (permalink)  
Old 04-22-2011, 08:27 AM
Junior Member
 
Posts: 8
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
Reply With Quote
  #5 (permalink)  
Old 04-25-2011, 11:37 PM
Intermediate Member
 
Posts: 21
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..
Reply With Quote
  #6 (permalink)  
Old 04-26-2011, 01:01 AM
Junior Member
 
Posts: 8
Default

thanks for that.. Much appreciated. I will give it a whirl
Reply With Quote
  #7 (permalink)  
Old 04-26-2011, 01:15 AM
Intermediate Member
 
Posts: 21
Default

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.