# Uploaded file retention policy

**URL:** <https://forums.rocket.chat/t/uploaded-file-retention-policy/13994>\
**Category:** Community Support\
**Created:** [May 2, 2022, 2:14pm UTC](https://forums.rocket.chat/t/uploaded-file-retention-policy/13994 "2022-05-02T14:14:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnLukeP](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@JohnLukeP](https://forums.rocket.chat/u/JohnLukeP)\
**Post date:** [May 2, 2022, 2:14pm UTC](https://forums.rocket.chat/t/uploaded-file-retention-policy/13994/1 "2022-05-02T14:14:49Z")

</div>

Hi,

for my company we are using a dockerized Rocketchat 3.6.1 installation with filesystem storage on the same VM.

Since the upload directory is becoming too large, is there a way to configure on rocketchat a retention period for uploaded files, so that they will be removed from both DB and filestorage, in a clean way, thus avoiding to “brutally” delete them from the filestorage folder?

Thanks,

Gianluca

### Server Setup Information

- Version of Rocket.Chat Server: 3.6.1
- Operating System: Centos 7.9
- Deployment Method: docker
- Number of Running Instances: 1
- DB Replicaset Oplog: Enabled
- MongoDB Version: 4.0.19
- Proxy: Apache

---

<div class="post-metadata">

**Author:** ![dudanogueira](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/dudanogueira/32/2529_2.png) [@dudanogueira](https://forums.rocket.chat/u/dudanogueira)\
**Post date:** [May 2, 2022, 4:38pm UTC](https://forums.rocket.chat/t/uploaded-file-retention-policy/13994/2 "2022-05-02T16:38:56Z")

</div>

Hi!

We do have an option for retention policy:

> **[Retention Policy](https://docs.rocket.chat/guides/administration/settings/retention-policies)**
>
> Automatically prunes old messages across your Rocket.Chat instance.

---

<div class="post-metadata">

**Author:** ![JohnLukeP](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@JohnLukeP](https://forums.rocket.chat/u/JohnLukeP)\
**Post date:** [May 13, 2022, 1:56pm UTC](https://forums.rocket.chat/t/uploaded-file-retention-policy/13994/3 "2022-05-13T13:56:28Z")

</div>

Thanks very much! Does it also prune uploaded files exchanged on DMs and channels?

---

<div class="post-metadata">

**Author:** ![dudanogueira](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/dudanogueira/32/2529_2.png) [@dudanogueira](https://forums.rocket.chat/u/dudanogueira)\
**Post date:** [May 16, 2022, 4:29pm UTC](https://forums.rocket.chat/t/uploaded-file-retention-policy/13994/4 "2022-05-16T16:29:03Z")

</div>

Yes, it will prune all messages and attachments, unless you specify otherwise with the one of options.

---

<div class="post-metadata">

**Author:** ![JohnLukeP](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@JohnLukeP](https://forums.rocket.chat/u/JohnLukeP)\
**Post date:** [May 18, 2022, 11:30am UTC](https://forums.rocket.chat/t/uploaded-file-retention-policy/13994/5 "2022-05-18T11:30:08Z")

</div>

Hi @dudanogueira

I’ve activated the policy around one our and half ago, setting the configuration this way but the files are still present and occuping space on the disk. Is it a bug of this version or just a misconfiguration?  
Our requirement is to delete all files (and only them) older than 6 months.

Edit: scrolling to the top of the histories, I can see:

_File removed by prune_

But the drive is still full with files and their subfolders. As stated in the thread we’re using dockerized rocket with Filesystem storage.  
I’ve also tried entering the container and creating and deleting a file on the mounted volume: it works just fine.  
What could be happening? Why the pruning only deletes the references and not the files on the filesystem?

Edit 2: Also tested on another dockerized Rocket, version 4.6.1, filesystem storage. Files are stated as pruned on the chats but they still persist on the disk.

 ![image](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/2X/7/771f4e81effa7fabc7f2ae4956bc288a3af0827e.png)  
 ![image](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/2X/0/02bed42a61963531c5c619072e4b3616d287c643.png)  
 ![image](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/2X/1/1bcb3bae666cfa0ec62661b75eb37da2a69324d4.png)
