Koozali.org: home of the SME Server

Howto Mass delete selected email from user /cur folder

Offline cb-wizard

  • **
  • 31
  • +0/-0
Howto Mass delete selected email from user /cur folder
« on: March 14, 2008, 03:52:54 PM »
How can we mass delete selected email from the user cur folder?  We need to keep certain emails. Unable to access with webmail and/or outlook, couple hundred thousand emails in folder.  qmhandle does not delete messages, or we are using the wrong switch.

Thanks
...

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Howto Mass delete selected email from user /cur folder
« Reply #1 on: March 14, 2008, 04:28:56 PM »
How can we mass delete selected email from the user cur folder?  We need to keep certain emails. Unable to access with webmail and/or outlook, couple hundred thousand emails in folder.  qmhandle does not delete messages, or we are using the wrong switch.

Thanks
Perhaps it might help if you describe what switches you have used and what you have done that lead to this situation...
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline raem

  • *
  • 3,972
  • +4/-0
Re: Howto Mass delete selected email from user /cur folder
« Reply #2 on: March 14, 2008, 08:10:36 PM »
cb-wizard

Quote
How can we mass delete selected email from the user cur folder?

Your issue may simply be too many messages in the one folder, so you could move them to other IMAP folders eg split the quantity up into different folders so you don't have the same issue again. Use the command line and/or midnight commander (mc) to quickly do this.

If you really want to delete messages, and there are some messages you wish to keep, you should manually move these to another folder first eg using mc

As I understand it, qmhandle works on the mail queue, not on mail in user folders.

To delete
Use the command line
Login as root (or user with root privileges)
cd /home/e-smith/files/users/username/Maildir/cur

check the file listing
ls -al
delete all the files without confirmation - BE CAREFUL
rm -f *


Alternatively use midnight commander to list/view/tag/delete the files
mc
then F9/File/select group/*/Enter to tag all files
then F8 to delete all the tagged files

You can use mc to move files from folder to folder in a similar way, after tagging use F6 to move (instead of F8 to delete), and have the source location in one window and the destination location in the other window of mc.
...

Offline m

  • *****
  • 276
  • +0/-0
  • Peet
Re: Howto Mass delete selected email from user /cur folder
« Reply #3 on: March 14, 2008, 09:36:49 PM »
delete all the files without confirmation - BE CAREFUL
rm -f *
That may not work with a lot of files in the folder, as the argument list can be too long.
Alternatively use:
Code: [Select]
find -type f -exec rm -f {} \;

Offline psc

  • *
  • 151
  • +0/-0
Re: Howto Mass delete selected email from user /cur folder
« Reply #4 on: April 08, 2008, 10:46:22 PM »
...qmhandle does not delete messages, or we are using the wrong switch....
qmHandle is only or the mail queue, not for deliverd mails.
First, solve the problem. Then, write the code.