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

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 Display Modes
  #1 (permalink)  
Old 10-23-2009, 03:19 AM
Junior Member
 
Posts: 5
Default [SOLVED] How can I delete a folder in all accounts?

Hi everybody.

I am a newbie, and i would like to know how can i delete a folder that it's located in every mailboxes.

This folder was created when i migrated the mailboxes from MDaemon to Zimbra. This folder is the old trash folder in MDaemon and now it isn't necessary in my new Zimbra server.

Thanks.



Release 5.0.18_GA_3011.UBUNTU8_64 UBUNTU8_64 FOSS edition
Reply With Quote
  #2 (permalink)  
Old 10-23-2009, 03:23 AM
Zimbra Consultant & Moderator
 
Posts: 11,518
Default

You'd need to dump a list of all your accounts then use zmmailbox in a script to remove the offending folder. I believe there are some scripts in the forums that perform similar functions that you could probably hack - I'd suggest trying it on a couple of test accounts before going 'live' and also take a backup before you do.
__________________
Regards


Bill
Reply With Quote
  #3 (permalink)  
Old 10-25-2009, 08:07 AM
Trained Alumni
 
Posts: 54
Default

I would start by getting a list of all the accounts with zmprov and output those to a file with
Code:
zmprov gaa > /tmp/allaccounts
Then loop through each with zmmailbox with something like:
Code:
#!/bin/bash
DELFOLDER="/Path/of/folder/to/delete"
for ACCT in $(cat /tmp/allaccounts)
do
  echo "zmmailbox -z -m $ACCT df \"$DELFOLDER\"">>/tmp/deletefeed
done
You should definitely test with a subset of accounts before running over the whole mailbox. Note that in the script I wrote I echoed the zmmailbox commands to a file instead of executing them directly. This allows you to look through and make sure the feed looks right or to remove accounts you don't want to touch prior to executing it.

Note that you can try this interactively too to ensure you have the right paths set up. run
Code:
zmmailbox -z -m account_you_want_to_test
you will then be at the zmmailbox prompt. You can get a list of all folders with "gaf" or getallfolders and then do df or deletefolder "/Path/to/folder".

Last edited by alexkelly : 10-25-2009 at 08:12 AM.
Reply With Quote
  #4 (permalink)  
Old 10-26-2009, 10:35 AM
Junior Member
 
Posts: 5
Default All folders were deleted successfully

Thank you for your quickly responses.

I followed your instructions and wrote a little bash script that delete a folder from all accounts of a domain given in command line.
Reply With Quote
Reply


Thread Tools
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.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0