Empty trashbin automatically

Is there a way to force the trashbin to delete files over 30 days regardless of the space available in the user’s quota ?

The occ command has functions for cleaning and expiring trash: occ help trashbin:cleanup and occ help trashbin:expire you could use them together with a systemd timer job to run them every 30 days, e.g. on the 1st of every month. However, this would of course not only delete files that are 30 days old, but also files that have been deleted one day before. So maybe only a suboptimal solution.

Yes I could but it’s not exactly the aim. I just want to keep 30 days of trashbin no matter the user quota.

I could reduce the quotas once in a while but I have over 100 users…

The configuration option you are looking for is described here:

https://docs.nextcloud.com/server/18/admin_manual/configuration_server/config_sample_php_parameters.html#deleted-items-trash-bin

1 Like

Thanks for the link but this only applies if the deleted files are taking over 50% of the user quota. So if I have a user with 1 To quota using 300 Go his trashbin is never emptied.

What about auto, D? That looks like the correct configuration for your use case. If I read it correctly, it says:

delete all files in the trash bin that are older than D days automatically, delete other files anytime if space needed

The first rule looks independent from the need of space, doesn’t it? In comparison to auto and D, auto, which both say:

(note: files may not be deleted if space is not needed)

I guess, this limitation is left out with purpose in the description auto, D. Which makes sense, as the second value is always an upper bound, which makes it a hard limit if something else than auto is the second value.

Have you tried that already? If it doesn’t work, I’d argue the documentation is ambiguous.

My config.php holds

trashbin_retention_obligation' => '25, 30',

And I still have files in the trashbin that are over 2 months old…

I think the quota must configured with trash. But perhaps you can send all users an email to delete the trash regularly.

It would make sense that the trashbin_retention_obligation did not care about your quota state. I don’t get this 50% limit trigger

This line works.
But i don’t why it need some magics to apply.

Reboot the server, do a occ command for cleanup …
But i have the same line and it works for me now.
In my case it’s ‘60, 90’

It does work but only if you exceed 50% of your quota. I tested it by reducing the quota on one account and it did clear the trash correctly

For me it works but i don’t have quota, am i unlimited quota.
So if you have 100GB quota and use only 5GB maybe this line won’t work…
in this case it’s sad and need to get address to the devs.