What is the purpose of the lock file?

I’m running Windows 10 and noticed a file in the same folder where I save a Calc file, .~lock.nameoffile.xls#.

What is the purpose of this file and why do I even need it?

It is needed for two purposes:

  1. For some filesystems, there is no (reliable) locking of a file when an application opens it. This can lead to the file being opened for editing by two (or more) applications (e.g., over a network), which then will write to the file independently, with disastrous results. Creating the lock file in this case tells the other LibreOffice/OpenOffice (the two applications that know to look for the file) that the file is already in use.
  2. Also, the lock file has the information who and where has opened the file, which helps when a user wants to edit a file already opened by another user, and seeing the information, may call that other user to ask closing it.
1 Like