Owncloud has it’s own special php command console.
As the Owncloud file system user (in my case, admin), add this to cron:
php /home/admin/web/DOMAIN.COM/public_html/occ files:scan --all
Or if you’d prefer to do it as root:
sudo -u admin php /home/admin/web/DOMAIN.COM/public_html/occ files:scan --all
Replace DOMAIN.COM and the preceding file path with your public www folder.
This is especially useful when sending files to Owncloud via cron or download or a once off time so that Owncloud will display them.
I used this in the following example of a cron job to get Asterisk recordings of phone calls so that I could securely play them on my iPhone in my own time.