OwnCloud: how to copy files “directly” on your server

owncloudOwnCloud is really a terrific program.
I use it for many purposes, among which, of course, storing files that I can access from anywhere.

I faced a simple, but not trivial issue : I had a lot of files to move to my Cloud repository, already available on my server, and I didn’t want to go through the web interface or the webdav access (unnecessary bandwidth usage). I simply wanted to “move” them from directories, using Unix command line interface.

This is not straight forward, but not difficult either. Here is how I proceeded:

Step 1: move the files

I went to my owncloud repository directory (/var/www/owncloud/data on my computer), and I found the following structure:

  • . / <user> / cache
  • . / <user> / files
  • . / <user> / files_version
  • . / <user> / thumbnails

The files have to be copied under . / <user> / files / .

(Be careful with the Unix files permissions : you may need to modify them using “chown” command)

Step 2: update OwnCloud database

The trick is there… If you don’t do anything else, OwnCloud server will not “know” that new files have been uploaded…

So, you need go back to your OwnCloud server, and to the top directory (/var/www/owncloud on my computer).

Then, you need to launch the following command:

sudo -u www-data php console.php file:scan "<user>"

(replace <user> with the concerned user name, and I suggest to keep the quotes, as the user name may contain spaces…)

That’s all !

Note: you may rebuild the whole DB with this command (for all users), just by replacing the “<user>” with option “–all”

sudo -u www-data php console.php file:scan --all

Enjoy !

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>