What is a Locked File?

How to Move, Delete, and Rename Locked Files

Illustration of a man trying to unlock a computer with a giant key
© Fotosearch / Getty Images

A computer file that can be used by only a single program or process at one time is considered a locked file.

In other words, the file in question is "locked away" from being used by any other program on the computer it's on or even over a network.

All operating systems use locked files. In most cases, the purpose of locking a file is to make sure it can't be edited, moved, or deleted while it's being used, either by you or some computer process.

How to Tell if a File is Locked

You won't normally go hunting around for files that are locked - it's not a file attribute or some sort of thing you can pull up a list for. The easiest way to tell if a file is locked is when the operating system tells you so after you've tried to modify it or move it from where it's at.

For example, if you open a DOCX file open for editing, like in Microsoft Word or some other program that supports DOCX files, that file will be locked by that program. If you try to delete, rename, or move the DOCX file while the program is using it, you'll be told that you can't because the file is locked.

Locked file messages vary a lot, especially from operating system to operating system, but most of time you'll see something like this:

  • The source or destination file may be in use
  • You must close the file before proceeding
  • The process cannot access the file because another process has locked a portion of the file.

    It's similar with folders, which often show a Folder in Use prompt, followed by a Close the folder or file and try again message.

    How to Unlock a Locked File

    Moving, renaming, or deleting a locked file can sometimes be difficult if you're not sure what program or process has it open... which you'll need to close.

    Sometimes it's very easy to tell what program has the file locked because the operating system will tell you in the error message. Often times, however, that doesn't happen, complicating the process.

    For example, with some locked files, you'll be met with a prompt that says something very general like "the folder or a file in it is open in another program." In this case, you can't be sure which program it is. It may even be from a process running in the background that you can't even see is open!

    Luckily there are a number of free programs that clever software makers have created that you can use to move, rename, or delete a locked file when you're unsure of what's locking it. My favorite is LockHunter. With it, you can just right-click a locked file or folder to clearly see what's holding it, and then easily unlock the file by shutting down the program that's using it.

    As I mentioned in the intro above, files can also be locked over a network. In other words, if one user has that file open, it can prevent another user on a different computer from opening the file in a way that lets him or her make changes.

    When this happens, the Shared Folders tool in Computer Management comes in really handy.

    Just tap-and-hold or right-click on the open file or folder and choose Close Open File. This works in all versions of Windows, like Windows 10, Windows 8, etc.

    Once a file is unlocked, it can be edited or moved like any other file.

    How to Back Up Locked Files

    Locked files can also be a problem for automatic backup tools. When a file is in use, it often can't be accessed to the degree that a backup program needs to ensure that it gets backed up. Enter Volume Shadow Copy Service, or VSS...

    Volume Shadow Copy Service is a feature that was first introduced in Windows XP and Windows Server 2003 that enables snapshots to be taken of files or volumes even while they're being used.

    VSS enables other programs and services like System Restore (in Windows Vista and newer), backup tools (e.g. COMODO Backup and Cobian Backup), and online backup software (like CrashPlan and Mozy) to access the clone of the file without touching the original, locked file.

    Tip: See my Online Backup Comparison Chart to see which of my other favorite online backup services support backing up locked files.

    Using Volume Shadow Copy with a backup tool is a huge plus because you'll never have to worry about closing all of your open programs just so the files they're using can be backed up. With this enabled and in use, you can use your computer like you normally would, with VSS working in the background and out of sight.

    You should know that not all backup programs or services support Volume Shadow Copy, and even for the some that do, you often have to explicitly enable the feature.