[GNC] Accidentally Created .LNK file and now my entire GnuCash file is overwritten and I can't get back to work

Michael or Penny Novack stepbystepfarm at comcast.net
Mon Nov 5 10:41:25 EST 2018


On 11/4/2018 9:10 PM, David T. via gnucash-user wrote:
> As others explained, the lck and lnk files are created by gnucash to prevent users accidentally opening the data file on multiple machines. They are zero bytes in size and there is no point in trying to open them up. There is no there there.
>   
Sometimes it can help people remember if they are told why.

Why a file with no data? The lock file isn't intended to be OPENED. Only 
its EXISTENCE is being tested. That's what it is there for. If it 
exists, then some instance of the program has the corresponding data 
file open. When gnucash is about to open a data file, it creates a 
corresponding lock file, and when it closes that data file, it deletes 
the lock file. The existence of a lock file (for some data file) means 
that an instance of the program "owns" that data file, and no other 
instance of the program can touch it.

Why this way? Because a program can check for the existence of a file 
even if not allowed to open that file.

Of course if the program (or the system) crashes before the program 
closes a file and deletes the lock a lock file can get left behind.

Michael D Novack


More information about the gnucash-user mailing list