OCC files:cleanup - Does it delete the db table entries of the missing files?


Recently we ran into a problem after deleting some files that they still appear in the web interface, and also they block the desktop client sync process causing it to be kind of useless. We found out that the files are actually deleted from the server but the corresponding entries in oc_filecache table are still there. We solved the problem by simply deleting those entries from the table.

My question is whether there is a tool/command to delete the oc_filecache entries that has no related files on the server.
I read about the occ files:cleanup command but looks like it does the opposite [1]:

files:cleanup tidies up the server’s file cache by deleting all file entries that have no matching entries in the storage table.

Any ideas?

[1] https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/occ_command.html#file-operations

It does exactly what you need, removing the files entries in oc_filecache if the actual file is not there.

On top this command should be executed regularly by cron.php. How long after files removed did you still see them in the files app?

1 Like

In this case, the explanation in the docs is confusing especially the “in the storage table” part!

We noticed the problem immediately but it stayed there for while (sure more than the cronjob’s 15 minutes) before we solved it. However, we may had problem in our cron itself, so that is still a possible reason.
About the files:cleanup, we will try it in case the problem came back again. Thanks!

Yeah, I also remember stumbling about “table” there. Maybe because in the end everything is a table :smile:.

About cron: As far as I know some tasks of cron.php are also not done every cron execution. Every 15 minutes cleanup and therefore whole filecache scan would bring more performance loss than gain from my point of view.
In web ui admin panel you could/should check if cron is run regularly.

1 Like