Uploaded file retention policy


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?



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


We do have an option for retention policy:

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

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

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.