How to manually delete older file versions?

Hi, I’m running low on space, and I was wondering how to manually remove old file versions to free up space. It is these files that are taking up the majority of the space on the server as far as I understand (I haven’t checked the logs yet, and these have taken up a lot of space in the past).

You can set it in config.php when to delete trash/old versions.

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

https://docs.nextcloud.com/server/12/admin_manual/configuration_server/config_sample_php_parameters.html#file-versions

1 Like

I managed to fix the issue by deleting the files in the trash bin (which, interestingly, I’d barely paid any attention to before).

./occ versions:cleanup

https://docs.nextcloud.com/server/12/admin_manual/configuration_server/occ_command.html#versions

4 Likes

Thank you! This is exactly what I’m looking for.

About the automatic delete of old versions, using the key ''versions_retention_obligation" how it suposes that erases files? Which process is running?

Regards.

I´m also wondering when files are really deleted. In my case I lowered the “trashbin_retention_oblitation” setting in config.php and even run the cron manually. Files are still existing and not deleted (yet).

To be more precise: I don´t want ALL deleted files to be deleted (I could do that using occ), I only want those deleted being older than D configured in config.php.

Update:
Seems like the occ “trashbin:expire” command is working. Found it in an Owncloud doc (https://doc.owncloud.org/server/9.1/admin_manual/configuration_files/trashbin_options.html).

I would like to delete specific versions of a file as my settings keep all versions (I usually need them), but some versions are meant to be deleted and I can’t find an option to delete them or mark them for delete.
As an alternative it would be cool to keep different version settings by filetype.

2 Likes

If you only want to delete the old versions of a single file:
Create a copy of your file with a new file name → delete the original (including all old versions) → go to the recycle bin and delete the original with all versions → rename the copy back to the original file name if necessary.