Let's face it: you've got gigabytes of files to add to your ownCloud server. You can of course use the desktop client to sync all those files, but what if we were talking about almost a terabyte?
Add files manually to your ownCloud server
This is probably the quickest and less complicated way of adding files. There are many alternative ways to transfer your files to your ownCloud server:
- FTP Upload;
- SCP Upload;
- Local disk to ownCloud disk transfer;
- USB disk to ownCloud disk transfer.
It's just as simple as dragging a folder to another folder. The only problem is that you might not know yet where ownCloud files are stored. I made life a little bit easier with this nifty little Bash snippet that automatically finds your ownCloud data directory:
find / -name config.php 2>/dev/null | while read line ; do cat "$line" | grep " 'datadirectory'" ; done
Your output should then look something like this:
So according to the snippet of code my ownCloud data directory is located at
/var/www/owncloud/data so let's cd into that directory to check out what's in there.
As you can see, we have multiple files in here. My ownCloud username is
bart, so let's take a look in that folder.
Now this looks interesting. If I check my ownCloud web portal I can see that the directory structure is the same:
So I created a folder called TestFolder123 in the web interface and executed
ls -la on the server's console.
So I tried to do the same thing, but vice versa. I created a folder on the console side, updated the folder's ownership and afterwards checked if the folder appeared in the web interface, with some surprising results:
What the heck?!
Where did my folder go??!
Okay.. let me explain what's going on here. The ownCloud system basically expects two things from a file/folder in order to be indexed as a file:
- The file/folder needs to be physically available;
- The file/folder needs to exist in the ownCloud database.
Moving a file/folder into ownCloud's data directory doesn't add it to the database automatically. Luckily, the ownCloud developers were kind enough to create a command line tool called
occ that can manually add missing files and folders to the ownCloud database. You can run the following snippet on your server to check where this utility is located on the local file system:
find / -name "occ" 2>/dev/null
Which outputs the following on my demo server:
All you need to do is cd into that folder (in my case
/var/www/owncloud) and run the following snippet:
sudo -u www-data php occ files:scan --all
Where www-data is the user your web server runs on.
And now, it is time for the results:
YEAH!! So this command has definitely helped. Now you can add all your files directly into your ownCloud data folder without having to sync from the desktop client.