9

If you look in a folder where you open a Office document, .xls, .doc., .pst, whatever.... it also creates a file with the same name (or close to it) preceeded with a ~$. Getting a good definition of what these file are has been tough. Try Googling it and you will see. Some call them "Lock" files. Some call them "Temporary" files.

I can tell you what they aren't.... they aren't the AutoBackup/Recovery files used to recover the documents in case the program crashes. You can tell Excel where to keep those and by default they are kept in C:\Users\Users\AppData\Roaming\Microsoft\Excel (or word or whatever).

So what are the ~$ files created in the same directory when you open a Office document?

1
  • When you save an Office document, one of these files is created. Normally when you close the original document they're deleted. Sometimes (like if Word crashes or you lose network connection to the save location) they don't get removed. Commented Mar 21, 2017 at 22:21

1 Answer 1

10

These files exist so that Office can report the user currently holding the file open.

Suppose you have a document on a network share and you want to edit it. Word tries to open the file, but that operation fails because the file is in use by someone else. You really need to work with the file, so you want to find the person who's holding it open and ask them to close it. If you had sufficient access to the file server, you could use the Shared Folders snap-in for MMC, but otherwise, you're stuck.

Therefore, Office writes one of these tiny files when opening a document. It records the display name of the current user. When another Office instance tries to open the file but gets an error, the Office program accesses this file and shows you the name of the person responsible for the lock. You can verify this in a hex editor: the first byte is the length of the display name, then the next run of that length holds the actual name. Then there's also some other data, some of which appears to be the display name again (but in UTF-16LE) and the rest of which I can't make out.

From Description of how Word creates temporary files (outdated but still helpful):

Owner File (Same Directory as Source File)

When a previously saved file is opened for editing, for printing, or for review, Word creates a temporary file that has a .doc file name extension. This file name extension begins with a tilde (~) that is followed by a dollar sign ($) that is followed by the remainder of the original file name. This temporary file holds the logon name of person who opens the file. This temporary file is called the "owner file."

When you try to open a file that is available on a network and that is already opened by someone else, this file supplies the user name for the following error message:

This file is already opened by user name. Would you like to make a copy of this file for your use?

2
  • So you are of the opinion that it is a "Lock" file or as you call it a "Owner" file? Can you site that source? Commented Mar 23, 2017 at 1:17
  • 3
    @ZiggyStardust Yes, "owner file" is the terminology used by this MS article.
    – Ben N
    Commented Mar 23, 2017 at 1:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .