# Delete old messages?

**URL:** https://forums.rocket.chat/t/delete-old-messages/1406
**Category:** Community Support
**Created:** [June 25, 2018, 3:16pm UTC](https://forums.rocket.chat/t/delete-old-messages/1406 "2018-06-25T15:16:41Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![yeken](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/yeken/32/364_2.png) [@yeken](https://forums.rocket.chat/u/yeken)
#### Post date: [June 25, 2018, 3:16pm UTC](https://forums.rocket.chat/t/delete-old-messages/1406/1 "2018-06-25T15:16:41Z")

</div>

Hi folks,

I’m about to write something in PHP to clear chat history older than x days.

Before I do it, is there already something build in to RC?

Cheers!-

---

<div class="post-metadata">

### Author: ![aaron.ogle](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/aaron.ogle/32/15_2.png) [@aaron.ogle](https://forums.rocket.chat/u/aaron.ogle)
#### Post date: [June 27, 2018, 12:09am UTC](https://forums.rocket.chat/t/delete-old-messages/1406/2 "2018-06-27T00:09:21Z")

</div>

There is not. I believe there is a PR in progress here:

> <https://github.com/RocketChat/Rocket.Chat/pull/11236>

---

<div class="post-metadata">

### Author: ![Rosalina](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/rosalina/32/473_2.png) [@Rosalina](https://forums.rocket.chat/u/Rosalina)
#### Post date: [August 3, 2018, 6:19am UTC](https://forums.rocket.chat/t/delete-old-messages/1406/3 "2018-08-03T06:19:17Z")

</div>

I’ve done this but use Mongo settings to auto-delete anything over x days. Happy to share settings if you’d find it useful

---

<div class="post-metadata">

### Author: ![chatdev](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/chatdev/32/481_2.png) [@chatdev](https://forums.rocket.chat/u/chatdev)
#### Post date: [August 8, 2018, 2:16pm UTC](https://forums.rocket.chat/t/delete-old-messages/1406/4 "2018-08-08T14:16:38Z")

</div>

I would love to get some help with that. I have installed the snap version of RC, but can’t access the Mongodb settings. So I am manually cleaning the rooms every night, which doesn’t work in the apps (history still visible until you reset the cached data) and all the files remain online on my server.

I really really would love to have the new option “Message retention policy and prunning” but I am still using 0.66.3 because that is the latest available snap version.

A temporary other solution would help me a lot!

Thanks,

Stef

---

<div class="post-metadata">

### Author: ![Crisna](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/crisna/32/497_2.png) [@Crisna](https://forums.rocket.chat/u/Crisna)
#### Post date: [August 11, 2018, 9:48pm UTC](https://forums.rocket.chat/t/delete-old-messages/1406/5 "2018-08-11T21:48:42Z")

</div>

Que legal, poderia compartilhar comigo ? Estou em busca de algo assim há alguns dias já, mas, não está dando certo.

---

<div class="post-metadata">

### Author: ![aaron.ogle](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/aaron.ogle/32/15_2.png) [@aaron.ogle](https://forums.rocket.chat/u/aaron.ogle)
#### Post date: [September 11, 2018, 5:06am UTC](https://forums.rocket.chat/t/delete-old-messages/1406/6 "2018-09-11T05:06:47Z")

</div>

The latest release should definitely have the message pruning feature now. Of course released on snap too

---

<div class="post-metadata">

### Author: ![chatdev](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/chatdev/32/481_2.png) [@chatdev](https://forums.rocket.chat/u/chatdev)
#### Post date: [September 11, 2018, 6:41pm UTC](https://forums.rocket.chat/t/delete-old-messages/1406/7 "2018-09-11T18:41:10Z")

</div>

Yes it is working very good now. Thanks!
