How to force delete of versions in files_versions

I setup nextcloud 2 weeks ago and I only noticed now that the versioning folder has grown out of proportion (126Gb for a folder structure of 23 Gb). The reason is that the windows nextcloud client kept trying to save different outlook .pst files that were in use / locked and created a gazillion versions in /usr/share/nginx/nextcloud-data/my_user/files_versions/My Documents Home/Outlook Files.

On the Windows client I added the outlook folder to the excluded files and I can see that I have no new version in files_versions since I did this. BUT I still have 114G of files I want to delete.

My user had an unlimited quota and I changed that to 30 Gb to force the versioning app to prune old files, but I don’t see anything being deleted.

Can I manually delete the files in “/usr/share/nginx/nextcloud-data/my_user/files_versions/My Documents Home/Outlook Files” or will it mess up indexing and the database?

If not, how do I get rid of the old versions?

On a related note, I searched if nextcloud was able to process locked files such as outlook PST files (Volume Shadow Copy), like other sync programs do, but I haven’t found how to include PST files in nextcloud. Any suggestions?


1 Like

There is an occ command version:cleanup, which deletes all files in the files_versions directory. I use this on my home instance every now and then. However, this deletes the files for all users. I do not know how to run the command for a specific user only. Maybe in the doc this is further explained.

1 Like

Thank you @smeijer. After I posted I kept digging and I ran manually sudo -u www-data php -f /usr/share/nginx/nextcloud/cron.php, it did clean the directory, but it’s a workaround - not sure why it didn’t run on its own.

FYI: “You can delete versions for specific users in a space-delimited list”.