delete dir: directory is not empty


(weyou) #1

Just found one of my synced folder shows “Out of Sync” with several failed items. All failed items show error:

delete dir: directory is not empty.

Here are my settings:

  • The “Out of Sync” folder is a receiver folder with “Receive only” setting
  • The master folder shows “Up to Date” with “Send only” setting

I checked each of the failed items. Most failure caused by the folder has been deleted on the master folder but failed to delete on receiver folder. I have resolved such kind of issue temporarily by “Remove folder manually on receiver disk and click Revert Changes”.

But one of the failed folders actually never be deleted anywhere in the past. It’s a virtual machine folder of a VirtualBox. Now Syncthing always shows “delete dir: directory is not empty”.

I have tried to manually delete that folder in receiver disk and click “Override the Changees” on master, the folder will be transferred to receiver again. But after that, it still shows the failure “directory is not empty”.

How can I debug this issue or force discard the “delete dir” change?


(Audrius Butkevicius) #2

This is most likely caused by ignore patterns


(weyou) #3

Here is my ignore patterns setting on the master folder:

$RECYCLE.BIN
System Volume Information
//Skip office temporary file
~$*
*.tmp
*.pyc
*.log

The problem folder does have a sub folder contains the files match the pattern “*.log”. Any clue from this information?


(Audrius Butkevicius) #4

Well if .log is ignored and in that folder, syncthing won’t be able to delete the files or the folder obviously. Please check the ignore docs which explains this.


(Simon) #5

The important part is: Do patterns match between the two devices? For an explanation how this error can happen and how you can fix it, see Files matching (?d) rule aren't deleted


(Audrius Butkevicius) #6

There is no (?d) rule in this case.


(Simon) #7

Doesn’t matter, the same thing can still happen. If a directory containing ignored files (regardless of ?d) is deleted by the user Syncthing will only send an update for the directory, not the contents. When the other device without the ignore patterns tries to delete that directory, it encounters valid (not ignored files) and refuses to delete with this error message.

If these files were ignored but not deletable (no ?d), the error message would say something about ignored files.


(weyou) #8

@imsodin @AudriusButkevicius Thank you all for your help. You are great!

The problem has been solved.

After read the linked post, I set the same ignore pattern to the receiver. After it auto-scanning completed, Syncthing still got “Out of Sync” and the error message: (Not the exact words)

the folder contains ignored files(See ignore (?d) pattern documentation)

I tried to add the (?d) prefix to the “*.log” pattern both on sender and receiver. Then the issue has gone.