Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » Delete old emails from KMS in any folder (not only spam and trash) - solution
  •  
soukupl

Messages: 70
Karma: 0
Send a private message to this user
Kerio introduced option to auto-delete old emails from SPAM and Trash. This is definitely very useful feature, but sometimes you can need to use this feature also on different folders (in my case INBOX)...

As I really need to delete all emails older then 3 days from INBOX on several accounts, I have written small utility in .NET to do this over IMAP.

If you are interested, you may download this on my page at http://git.ladasoukup.cz/imap-prune/src (source code and binary). It is called IMAP prune and it is very easy to use command line utility.

Basic usage:
IMAP_prune.exe /server: /user: /pwd: /folder: [/hours:] [/days:]

/server - IMAP server hostname (ex. mail.example.com)
/user - IMAP username (ex. user<_a.t_>example.com)
/pwd - IMAP password
/folder - IMAP folder (ex. INBOX)
        - folder names are CASE sensitive!
        - leave empty or not set to list all availible folders for account.

/hours - delete all email odler then this value (hours)
/days - delete all email odler then this value (days)
Note: hours and days will be added together. Default value is 30 days.


Example:
imap_prune /server:mail.example.com /user:user<_a.t_>example.com /pwd:PassWord /folder:INBOX /days:14

There should be the "at-sign" instead of "<_a.t_>" (this char is replaced by this forum).
This will also work with any IMAP enabled server.

Let me know, if you find this utility useful.

[Updated on: Thu, 08 November 2012 20:12]


Ladislav Soukup
  •  
LinuxLover

Messages: 13
Karma: 0
Send a private message to this user
Hi,

Good job. I just don't know much about Microsoft Programming Smile. I tend to code for Linux.

On Linux I usually use something like this:


find /store -name '*.eml' -mtime +90 -exec rm {} \;

This command will just find .eml files in the store directory that are older than 90 days then delete them. Make sure to stop KMS and also to re index those folders.

Thanks




  •  
soukupl

Messages: 70
Karma: 0
Send a private message to this user
LinuxLover wrote on Sun, 01 March 2009 03:11

find /store -name '*.eml' -mtime +90 -exec rm {} \;


Yes, this should work... I did try to use batch script to directly delete eml files from KMS store and it worked. However, KMS crashed few times when I was deleting large amount of emails using this batch. I Don't know if the batch was the problem or not, but I stopped using it... and switched to IMAP method.

Anyway, using IMAP is "cleaner" and can be used on almost any server with IMAP support.

Ladislav Soukup
Previous Topic: Problems with Safari and composing HTML emails
Next Topic: Migrate Mac OS X Server 10.4 mail to Kerio Mail Server
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Thu Nov 23 06:31:17 CET 2017

Total time taken to generate the page: 0.00360 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.