Setting a maximum period to keep versions
Open the /config/config.php file for editing and add the following line.
'versions_retention_obligation' => 'auto,365',
The first parameter (auto) is the minimum time that a version should be kept for, and the second parameter (365) is the maximum number of days that versions should be kept for.
According to Nextcloud
The Versions app (files_versions) expires old file versions automatically to ensure that users don’t exceed their storage quotas. This is the default pattern used to delete old versions:
- For the first second we keep one version
- For the first 10 seconds Nextcloud keeps one version every 2 seconds
- For the first minute Nextcloud keeps one version every 10 seconds
- For the first hour Nextcloud keeps one version every minute
- For the first 24 hours Nextcloud keeps one version every hour
- For the first 30 days Nextcloud keeps one version every day
- After the first 30 days Nextcloud keeps one version every week
The versions are adjusted along this pattern every time a new version is created.
The Versions app never uses more that 50% of the user’s currently available free space. If the stored versions exceed this limit, Nextcloud deletes the oldest file versions until it meets the disk space limit again.
You may alter the default pattern in
config.php. The default setting is
auto, which sets the default pattern:
'versions_retention_obligation' => 'auto',
Additional options are:
- Keep versions at least for D days, apply expiration rules to all versions that are older than D days
- Delete all versions that are older than D days automatically, delete other versions according to expiration rules
- Keep versions for at least D1 days and delete when they exceed D2 days.
- Disable Versions; no files will be deleted.
Thanks for visiting.