MS Office Lock-File (owner file) behavior differs between Netdrive and Synced-Folders

Hi all,

Nextcloud 12.0.3
All Clients: Windows 7

I have a strange behavior of MS Word/Office/Visio when opening files that are already opend by another User.

Situation A (working as intended):

  • test.doc file located on a network drive x:
  • User A opens test.doc with MS Word 2010
  • a hidden lock-file (owner file) is createt named ~$test.doc
  • User B can open that lock-file in Nodepad++ and read User A’s username
  • User B opens test.doc and get a message, that the file is already in use by User A

Situation B (not working):

  • test.doc file is located in a folder which gets synced by the Nextcloud Sync-Client
  • Sync-Clinet is configured to sync hidden files
  • snyc-exclude.lst is altered to sync MS Office lock-files (owner-files)
  • User A opens test.doc file with MS Word 2010
  • a hidden lock-file (owner file) is createt named ~$test.doc
  • the lock-file gets synced over to User B’s Nextcloud Sync-Folder
  • User B can open that lock-file in Nodepad++ and read User A’s username
  • User B opens test.doc, NO “already in use” message is shown
  • Both users can edit and save the document

I really don’t understand why Word recognises the lock-file in situation A and ignores the file in situation B.
I must use the nextcloud sync-client and i also need to make sure, that file locking works. Collabora is no option.
Does anyone have a hint or solution for this problem, or can explain why office behaves like that?

desperat greeting,



we are observing the exact same situation. Are there any hints out there?

Kind regards!

well…i kind of “fixed” it myself.
I wrote a wrapper in .NET that checks for office lock-files. This tool is now the standard application for Word/Excel/Visio files.

  • enable sync for hidden files in nextcloud sync client
  • remove the “~$” line out of the sync-exclude.lst (in nextcloud install flder)

Then the office hidden lock-files get synced. It takes about 5-15 seconds to get this file synce between all users
Write a wrapper that checks for those hidden files. The naming is pretty messed up by microsoft and is like follows:


  • file12.docx (length <=6 characters): lock file name is: ~$file12.docx
  • file123.docx (length = 7 characters): lock file name is: ~$ile123.docx (first char gets stripped off)
  • file123456.docx (length >=8 characters): lock file name is: ~$le123456 (first two chars get stripped off)

naming for .docx and .doc are identical…


  • file12345678.xlsx: lock file name is ~$file1234567 (identical for all filename length)

Old .xls lock-files do not work. they are stored in windows temp folder under cryptic name!


  • file12345678.vsd: lock file name is ~$$file12345678.~vsd (double $ and ~ in suffix)



sounds great. Would you like to make it pulic available?

Sorry that this took me so long. I completely forgot about it.
So, for everyone who is interested in my little wrapper, I set up an Github repository:

It’s under MIT Licence, so feel free to do what ever you like with it. If you make it better, please share it with the community.