Search code examples
mysqllinuxowncloud

OwnCloud: How to synchronyze the FileSystem with the DB


I have to "insert" a lot of files into an owncloud server (8.2). A user give me a USB key with the files and tell me to copy of all them into his owncloud data files repository.

Do you know if is it possible ? Is it possible to synchronyze the ownCloud data fileSystem with the ownCloud database?

My environment is Linux CentOS7 (Apache 2.4, mySQL 5.6, php 5.6)

Thanks,


Solution

  • owncloud brings a command line utility that allows to manually trigger some tasks. Among those is the files:scan function which re-scans a users file system.

    So you can import those files by following these steps: 1. you copy the files into the physical file system of the user(s) inside ownclouds data folder 2. you fire the command line utility to re-scan the files. That takes care to update the database according to the files found.

    This is an example for the manual trigger:

    sudo -u www-data php occ files:scan <user name>
    

    Here <user name> obviously has to be replaced. Also the account name the sudo command switches to depends on the linux distribution and its setup. The command has to be started inside ownclouds base folder. THe command can be called in a loop with different user names, that can be done by means of standard scripting.

    Here is a documentation of the utility: https://doc.owncloud.org/server/8.0/admin_manual/configuration_server/occ_command.html

    I just made a try myself using an owncloud-8.2 installation and succeeded.