Why can’t Windows move a document that is opened in Word?

2.04K views

Why can’t Windows move a document that is opened in Word?

In: Technology

4 Answers

Anonymous 0 Comments

Windows can’t move any file that’s currently open in a program because then that program wouldn’t be able to access the file, because it’s not where it was and it has no way to find it. It’s by design to prevent errors.

Anonymous 0 Comments

When an application opens a file, it is able to lock it to prevent any modifications to it. It’s like telling everyone “Don’t touch this file, I am working on it”. There are multiple types of file locks, i.e. there’s an exclusive lock which prevents any kind of access to file, there’s a lock that allows other applications to read the content of the locked file, etc. Generally it’s up to an application to decide which type of file lock to use.

Anonymous 0 Comments

Howd you get to post an ELI5 without flair? Isnt that a rule

Anonymous 0 Comments

As others mentioned, Windows has strong conventions for telling other programs (and even the operating system) that a file is currently being operated on by a program. To simplify programming, many Windows programs simply flag a file as locked when it’s opened and arrange for the lock to be released when the file is closed (either intentionally, or because the program closed).

What you’re observing happens because Word tells other programs it’s working on the file the moment it’s opened, and only releases this lock when the file is closed.

Just a note that this is just a strong convention on Windows. In other operating systems, these conventions for locking files are less universal. For example, on operating systems that are a form of Unix (Linux, MacOS, Android, iOS) most programs will store the files they have opened somewhere else, and only write the entire files to disk when you hit Save. This minimizes the chance of data corruption, while avoiding the headache of coming up with a universal conversion for locking files. Where locks are required, programs usually come up with their own method…but this is tricky, because on UNIX, it is not uncommon for files to be opened by programs running on different machines. Performing file locking in these scenarios is…kinda tricky. For example, what if a program on another machine locks a file on yours and it’s internet connection drops?