Rescan files on shared server

My database seems inconsitent, files present on sftp are not synchronized and missing in the web-interface. I probably should start a rescan (occ command) in the cli.
But …

  • I use Onwcloud on a shared server (
  • I do not have access to ssh or command line.
  • I can use sftp and mysqladmin.
  • There is also a cron service enabling me to run cron.php in regular intervals.

Is there a way to trigger a file scan to get the database consistent with the existing files?

Thank you


maybe you can run the occ command to rescan the files via cron the same way you’re running it for the cron.php?

1 Like

Hi Tom
Thank you for your interest. My hoster offers a kind of webcron, allowing to launch php-sides with a command like “www.mysite.xy/owncloud/cron.php”. He probably blocks attempt to use cli-commands. I have tried, but I could not figure out a syntax working with “occ” instead of “cron.php”. To my knowledge, “occ” itself launches the command “console.php”. But again, I could not figure out a syntax to trigger the desiered function “files:scan --all”
Thank you Fabio

Very interesting idea! Thanks so far.


maybe its possible to somehow call external commands like occ from a php file which is in turn called by the webcron?

But from your description it looks like you’re using ownCloud in a more advanced way, maybe switching to an hosting plan which gives you more control via SSH might be another alternative?

Nice Idea. Worth a try. And here, what I have tried:

<?php $output = `./occ files:scan --all`; echo "
"; ?>

In a file called rescan.php
And now, what I got - not surprisingly:
“shell_exec() has been disabled for security reasons …”

But: since “occ” calls console.php, it should be possible to trigger the scan from a php-file. But, which command, how to use it?


There exists a file:
What is probably more or less what I need, but it primarilly exports a class ScanFiles.
So it seems possible to generate a background job (re-)scanning files, but… how to trigger it?
Thanks - Fabio

There also seems to exist a function “filescan()”;
But I dont know where to find it, and how to import and call it.

Finally, after having installed a reliable cron-service, the database repaired itself.
Nevertheless, it is regretable that the administrator can not launch a complet database rescan from the administration console.


Here I fully agree with you. Could you please give more details on how your solution looks like? You can PM me if you don’t want share with public.

Hi Alfred
The cronjob just starts the cron.php every 15 min. scan.php is a backgroudjob that ist launched by corn.php by default. It does not scan the entire filesystem at once (may be due to script execution time limits), but after hours and days everithing should be scanned if the users aren’t to busy…
The (web)cronjob is launched by my hoster, who offers the possibility to set up this kind of function.
This may also be done by an external webcron service (see documentation).

1 Like

Thanks for this description! Sounds very interesting. I’ll have a deeper look inside later.