How to Move, Delete, and Rename Locked Files

Getting a 'locked file' error? Here's what it means and how to fix it

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.

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

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

Other programs will actually generate a locked file with a particular file extension like .LCK, which is used by programs from Autodesk, VMware, Corel, Microsoft, and likely others. Others might use the .LOCK file extension or something similar.

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

  • The source or destination file may be in use.
  • The action can't be completed because the file is open in another program.
  • You must close the file before proceeding.
  • The process cannot access the file because another process has locked a portion of the file.
  • This virtual machine appears to be in use.
File in use error in Windows 10

It's similar to 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!

Fortunately, 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. Our 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.

LockHunter showing a locked file

As we 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.

If you're dealing with a specific error like the "virtual machine" error from above, you might need to investigate what's going on. In that case, it's usually a VMware Workstation problem where LCK files are not letting you take ownership of the VM. You can just delete the LCK files associated with the virtual machine in question.

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 (like COMODO Backup), and online backup software (like Carbonite) to access the clone of the file without touching the original, locked file.

See our Online Backup Comparison Chart to see which of our 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 few that do, you often have to explicitly enable the feature.

Was this page helpful?