OCC - files:scan


Changed the data directory of my owncloud instance to:

‘datadirectory’ => ‘/opt/ocdata/’,

Then copied folders of data to /opt/ocdata/myuser/files/

Ran sudo -u www-data /var/www/owncloud/occ files:scan --path=“myuser/files”

Runs ok, but it’s scanning the old folder in the wrong path. It’s scanning this:


What is the correct way to get occ files:scan to scan the new data directory?

OwnCloud version is
Edition is community
OS is Ubuntu 18 server
php 7.2.10





so, based on this I can create a symlink and not have to modify any database or config.php?

If so, I will replace

‘datadirectory’ => ‘/opt/ocdata/’,


‘datadirectory’ => ‘/var/www/owncloud/data/’,

not sure why there would be an option to set a datadirectory in the config if it isn’t going to be respected




i think as long as your PHP setup is allowing to follow symlinks then this should work.

From what i know it is respected once during the installation and currently can’t be changed without additional modifications within the database like described in the posted link.

Ok, so here is where I am with this:

  • yes, editing the config.php file will allow you to use a different folder as the data folder for owncloud (restart apache)
  • some things to be aware of when moving files into this folder (also outlined in some of the resource links provided by alfredb
  • symlinks are not needed
  • how you copy/move the files into the folder is important. depending on the way you move/copy the files you may miss moving/copying some hidden files
  • you have to chown the folder/files recursively to www-data
  • you also have to rescan the folder(s) so owncloud picks up the changes:

sudo -u www-data php /var/www/owncloud/occ files:scan --all

Yes, we all (ok ,most of us) know that. So what?

Perhaps you should spend more time providing useful comments and less time sharing your inarticulate and vapid thoughts.

Yes, maybe you’re right.

I had a similar problem, just to help someone with this issue.
When you move your data to a different folder, I my case a new server, different linux distro, etc., even with the right permissions you get this error. We change a CentOS 7 to Debian 11, and after changing all file system permissions, the error was the same…

This is due to the database home setting on the oc_accounts table. You need to update to the new path otherwise the error may misslead you.
Command (home, 'old_path, '‘new_path’):

UPDATE oc_accounts