Syncing with Windows shares

Nextcloud server 13.0.1 on Ubuntu 16.04.3
Nextcould client 2.3.2 (build 1)

My server is part of the local network and I added “SMB / CIFS” to connect it to my shares.
My shares are regular Windows shares on Windows server 2003.
So, I use the Web interface to connect the shares using my AD Domain administrator credentials.
Then I use the Nextcloud client on a Wndows 10 PC to create the Sync connection.

Almost everything works great.

But in some share, some folders don’t sync properly.
What happens is if I delete a “rogue” folder from the local side it immediately comes back instead of deleting it from the server remote share. The folder is empty and does not contain any hidden or system file/folder

Most folders will behave normally.

I tried removing the folder sync connection from the client, delete everything in the local folder including hidden and system files/folders then re-create the same folder sync connection and it rebuilds.
Then the same problem occurs with the same folders.

Now, when I delete those rogue folders from the remote shared folder they disappear normally from both the share and the local folder as intended.

I would really like to understand what is going on. Why some folders and not others.

Hi, This is an update.

I upgraded to 13.0.2

It still does not always sync.

Today I created a word document on the remote folder and, so far (20 min.), it did not sync with the local folder.

I tried forcing sync and I rebooted the nextcloud server.

I’m not even sure if it will eventually grab the word document.
I’ll wait to see.

But, why would it not see that there is a file to sync?
When I login to the web management I can see that the file is there.

It finally copied to the local folder.

Again, I’m puzzled. Why did it not grab it when I forced sync?

It took about 25 min. for the nextcloud client to realize there was a new file to sync.

The sync was triggered after you did browse into the folder via web, right? How do you expect the server to know from a change in an external file system? There is no constant monitoring. You do need to setup the notification service.

Thanks for pointing it.
I was hoping that the fact of forcing a sync on the client would trigger the nextcloud server to check for changes.
I went and read the document you linked but this is too advanced for me.
About this line: " To start listening to update notifications, start the occ command like this:"

What is occ? I tried “occ files_external:list” in putty and it gives me occ: command not found

Update (18/05/10) I want to add that the smbclient installed version 2:4.3.11 is installed.

You are missing a few parts of the command. First, you need to specify where to find occ. Easiest way is to first navigate to the root folder for nextcloud and run a command similar to this: (change according to your system. My version is working on FreeNAS). You can also read more about the occ script here

sudo -u www php occ files_external:list 

The most probable part you need to change is “www” to “www-data” if you use ubuntu or similar OS. If you wondering what the parts of the command do, read further. If not, I still leave it here in case someone finds use for it

sudo -u www 

Means that what is after should be run as the user “www”. occ needs to be run as the webserver user to work properly.


Is there since occ is a php script. After those parts, you can write the command as they are described in the documentation.


Is the path to the file. If you have navigated to the correct folder, it is just the file name. Change accordingly

Thanks so much for this information.
I’m progressing. I hope you don’t mind assisting me a bit more.

The command works. I’m on Ubuntu 16.04 and the occ is located at /var/www/nextcloud

So I ran the command
sudo -u www-data php occ files_external:list
and got
No admin mounts configured

I guess it makes sense because all I have set on my nextcloud server are smd/cifs links to Windows shares on our local network.

Now I’m supposed to enter this command to "start listening to update notifications"
occ files_external:notify <mount_id>

If I have no “admin mounts” I also have no mount_id

I probably don’t understand exactly how it works.

Am I dong this correctly or is there another proper way to connect nextcloud to my Windows shares?

I found out exactly how to get the mount ids (had to add --all at the end)

sudo -u www-data php occ files_external:list --all

Now I get all the linked smb shares with their mount IDs.

So, now I can use the command

occ files_external:notify 1
And it just waits

It seems to be working as long as my putty window stays open.
But it does not seem to work in subfolders unless I force sync.

I don’t see any instructions to set this permanently. (Or I just don’t understand the documentation.)

Is there an easy step by step guide somewhere?

Hi I tried to run this command, but get messgae could not open input file and Command ooc not found. Can anyone help me?