13

Why does Microsoft Word create another copy of the same file, but hidden, whilst in use?

And why does the file created whilst in use always have "~$" replacing the first 2 letters of the file name?

For example:

An example

1
  • 4
    Its used as a lock file.
    – Ramhound
    Commented Mar 27, 2014 at 13:07

4 Answers 4

20

The file you refer to is a temporary file which serves a number of purposes. From Microsoft themselves:

A temporary file is a file that is created to temporarily store information in order to free memory for other purposes, or to act as a safety net to prevent data loss when a program performs certain functions. For example, Word determines automatically where and when it needs to create temporary files. The temporary files only exist during the current session of Word. When Word is shut down in a normal fashion, all temporary files are first closed and then deleted.

Speed

Going on from this; these temporary files help improve speed. If your system is struggling with not enough memory, Word will help it along by shifting non used functionality from memory to disk in the form of a temporary file.

Integrity

In order to ensure the integrity of your file in the event of system error, information is written to temporary and onto the original file. Should you have any error occur it can be restricted/recovered from temporary files rather than your core file.

Locked Files

When you open a file that is locked, either because it is open in another window of Word or because another user on the network has it open, you can work with a copy of the file. Word places this copy in the Windows Temp directory. Likewise, if a template attached to a document is locked, Word automatically makes a copy of the template in the Temp directory. The copy of a locked file does not automatically update the original owner's file.

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."

Source - Microsoft

This is a sizable topic. I have provided a number of examples on this files useage, but please use the source provided for a detailed list of reasons from Microsoft. I don't want to copy/paste the entire page here.

6
  • 1
    This is incorrect, the files are there to prevent two users from trying to edit the files at once, a situation that causes the This file is locked for editing by... message. Word also uses autosave files to allow document recovery but these are not the same thing and are stored in a different location.
    – James P
    Commented Mar 27, 2014 at 15:08
  • @James | I have included a bit on locked files. As you can see from the link it is a lengthy topic. I didn't want to copy reams of information and rather provide a couple examples and give reference to the source. For your benefit I have added this bit. Commented Mar 27, 2014 at 15:26
  • 1
    The ~$.docx files the OP specifically asked about are referred to in the article as Owner Files. Your article is right about the use of temporary files in general, I was simply pointing out what those specific ones were used for.
    – James P
    Commented Mar 27, 2014 at 15:29
  • 1
    @James | Apologies this is indeed correct. I have included the piece you mentioned in my answer to address this specific part of the OP. Thanks for pointing out that oversight on my part. Commented Mar 27, 2014 at 15:31
  • This only partially explains it. Why doesn't Microsoft just use the standard Windows file locking mechanism instead?
    – trlkly
    Commented Mar 28, 2014 at 2:33
6

Primarily because of the Autosave features. If you don't tell a document to save your changes, do you expect it to save over the original with no command to or warning that it will happen? It also allows your changes to be recovered if Word crashes and you hadn't saved for 2 hours. By default there will be a 10 minute old version of your changes that can be recovered.

On a more basic level, it allows one user to open a file on a share and read it while another user has it open for modification, though if multiple users are editing it, last-in-wins.

0

This file contains state information of your current editing. You should not bother about it. The intention is that when Word crashes (what virtually never happens, cough), Word would hopefully be able to recover the changes you have made but not saved yet.

-3

I believe that they are temporary files. Word deletes them after you save and close your file.

You must log in to answer this question.

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