What does "occ file:scan -all" actually do (with oc_filecache)?

Hello,

to me it is still not clear what it exactly does - also in relation to the oc_filecache:

  • does it scann all connected storage/folders recursively - also new folders and add them to oc_filecache?
  • or does it only scan known files/folders from the oc_filecache?
  • does it validate oc_filecache and also remove entries when files are deleted or external_shares are disconnected?
  • does it validate he data/cache folders and clean them up?

espacially its connection to the oc_filecache is very interesting to me because it seems only be growing and growing.
clearing the table and rescanning is also not a good solution if you are using shares or e.g. audioplayer because they rely on the file-id from filecache

thank you…

oc_filecache is not a cache, but a file index. Renaming is not possible, but don’t treat it like a cache, so never manually do stuff there (e.g. delete entries, purge, etc)

That is what is mostly used for

No

No

No

1 Like

thank you for the quick answer.

…but is there a cleanup process somehow available?
I can see that I connected a quite big SMB share for testing. I removed it again but several 1000 files seem to remain in oc_filecache.

Try occ files:cleanup but other then that I wouldn’t do anything

2 Likes

thank you for that.
I did not recognize when this was added to the docu

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

Sorry for posting on an old thread,
but, is there any problem if i use nextcloud while a file:scan --all is happening?
could the database broke?

thanks!

I got some database index corruption in oc_filecache and was not able to repair it. Am I right that doing occ files:scan --all will fully recreate this database table?

I did this several times without any problems. My corruption was most likely caused by apache+mysql service restart during occ preview:generate-all ran in background screen :stuck_out_tongue_closed_eyes:. Lucky me that my nextcloud instance is just for private use, playing and tinkering around.