Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » Possible to auto-delete all messages from all inboxes older than 12 months?
  •  
mfarley

Messages: 28
Karma: 0
Send a private message to this user
I'd like to run a nightly scheduled task that deletes any message in a user's inbox and inbox/subfolders older than 12 months.

If they want to keep a message indefinitely, they could move it to a custom 'do not erase' folder.

Is this possible with KMS?
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
I don't think this can be done through Kerio itself.

What you could do is, on the server itself, run a Winodws 'Find File' query on the mail store for all email files older than 12 months, sort the resulting files based on 'folder', select and delete all but the emails in the 'do not erase' folder, search again for the index files and delete them (will be reindexed automatically).

Too much hassle to do daily of course, but monthly could be done.

All of this of course while KMS is not running and only after having made a backup.

A better solution is probably just giving users mail quota and letting them clean out their mailbox themselves...
  •  
stranikm

Messages: 61
Karma: 0
Send a private message to this user
I am sure, that is not possible. But it is very interesting idea. I hope it will be possible in new version. But for us who knows kerio, do not believe it.
  •  
mfarley

Messages: 28
Karma: 0
Send a private message to this user
I have a script that will delete any files in a folder older than X months, that's easy. I can schedule it to run at the end of every month.

The hard part is the index files -- I'm not sure which ones to delete?
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
mfarley wrote on Mon, 05 September 2005 18:01

The hard part is the index files -- I'm not sure which ones to delete?

The index.fld files...
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
mfarley wrote on Mon, 05 September 2005 18:01

I have a script that will delete any files in a folder older than X months, that's easy. I can schedule it to run at the end of every month

I would not recommend running this script on a online server or without a proper backup...
  •  
mfarley

Messages: 28
Karma: 0
Send a private message to this user
Sweet.. I just did a test and it works perfectly.

All the inboxes get backed up on a nightly basis, data is secure.

I've been using the script for years in other projects and it works great. It will navigate through all sub folders removing files older than x days/months. I'll set it to do that to our kerio mail store, then have a separate script that runs right after which deletes *.fld
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
So this script excludes the folders 'do not erase' from its actions?
  •  
mfarley

Messages: 28
Karma: 0
Send a private message to this user
The user's mailfolders look like this:

/INBOX
/INBOX/ExampleSub1
/INBOX/ExampleSub2
/Sent Items
/Deleted Items
/Calendar
/Etc
/Saved Items

I'll only run the script on INBOX/+Subs, /Sent Items, and /Deleted Items

So any other folders are left intact (including a Saved Items folder).

  •  
mfarley

Messages: 28
Karma: 0
Send a private message to this user
UPDATE:

If I delete *.fld in all folders, Outlook won't open with an information store error.

The solution: delete all the index.fld's instead of *.fld

Works great.

-Matt
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
Yes, that's what I said: the index.fld files :-)
  •  
mfarley

Messages: 28
Karma: 0
Send a private message to this user
Whoops :) You're right.. I guess I got a bit overzealous :)
  •  
peterj

Messages: 852
Karma: 1
Send a private message to this user
Can we have your script...?
  •  
mfarley

Messages: 28
Karma: 0
Send a private message to this user
Sure!

the .php is what runs it, but you could recreate the logic in any command line scripting language.

Obsolete.com is the program that checks each file and deletes if older than X # of months.

The batch files are called by PHP which in turn run obsolete.com.

I ran into permission issues if I had PHP attempt to run obsolete.com directly.

You'll want to edit the first variable $root in the php script to point to your domain store in Kerio.

IMPORTANT NOTE: obsolete.com wants to see directories passed as oldschool 8 character equivalents. So instead of folder\sac-yolomvcd.com\ it wants folder\sac-yo~1.com

And instead of \myuser\Deleted Items
it wants \myuser\Delete~1

(in Windows 2000 use: dir /x to see a list of files with 8.3 equivalents)

I've zipped the files and they are available for download here:
http://www.fightthebite.net/mail_cleanup.zip

Notice the script only deletes INBOX/* , Sent Items/* and Deleted Items/*

-Matt



[Updated on: Sat, 10 September 2005 00:29]

arjen

Messages: 6
Karma: 0
Send a private message to this user
In a windows enivronment you could build an commandscript usin robocopy.
Previous Topic: Webmail: DSN Lookup Failure
Next Topic: Attachments turns to garbage
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: Sun Nov 19 07:47:10 CET 2017

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