Sync Nextcloud database with what is on the hard drive / filesystem

In case this is still of interest…
The occ files:scan command doesn’t fix database entries for files missing on the file system. It only adds files found on the file system to the database but not the other way around. (In my opinion it definitely should.)

As a work around you have to delete the entry in the filecache table directly.
SELECT * FROM oc_filecache WHERE path LIKE 'path_to_file';
and when you are sure
DELETE FROM oc_filecache WHERE path LIKE 'path_to_file';

If you accidentally delete too many files from the DB, occ files:scan will fix that for you. But be careful!