How To Delete, Move, or Rename Files In Use By Another Program

When you get an error message “The action can’t be completed because the folder or file is open in another program”, don’t worry. We’ll explain why this message or messages similar to this come up and how to delete, move, or rename a file easily.

You cannot delete a file when it is in use in Windows. When a process opens a file, it locks the file while it is in use. You will get the error message that you cannot delete the file because it is in use by another process. All operations to the file like delete, rename, open, edit, etc. will be disabled while the file is locked by another process.

Some quick solutions to File in use error

Use Windows Shadowcopy (VSS)

In a hurry to copy the file which is being used by another program? you can do it in one command! Windows Shadowcopy can be used to extract a copy of the file being used by the system itself. Follow the steps below:

  1. Open the command prompt with administrative privileges.
  2. Run the following command:
    esentutl /y <SOURCE> /vss /d <DEST>
    Replace <SOURCE> and <DEST> with the source and destination paths.
  3. For example,
    esentutl /y C:\Windows\regedit.exe /VSS /d E:\regedit.exe

This is how you can quickly copy the file without a lot of hassle.

Some file extensions are blocked by VSS like .OST and PST Outlook data files. To copy these files from VSS, you should delete the file extensions from the registry first. Go to the following registry key and delete your desired extension:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToSnapshot

Close the program

If you are using the latest version of Windows 10, you will note that it gives more details than the generic error which we mentioned above. Most of the time, Windows will be able to identify the program which is locking up the file and will specify this in the error message.

For example, in the screenshot below, Windows identifies and specifies that the PDF file is open in Foxit Reader. When I close Foxit Reader, I’ll be able to delete the file without any warnings.

File is open in another program
The action can’t be completed because the file is open in another program

But some processes become stubborn and don’t unlock the file even when they are closed and the file won’t delete whatever you do. For this, we will show you how to force delete a file even if it is locked. You can also force delete a folder using similar techniques.

Let’s discuss some of the instant solutions if Windows is not showing the process name which is locking the file.

Restart Windows Explorer

If a file is opened by Windows Explorer, it will get locked until Windows File Explorer releases it or we restart the process. To restart the Explorer process in Windows 10, follow the steps below:

  1. Open Windows Task Manager (Ctrl + Shift + Esc)
  2. Under the Processes tab, find Windows Explorer in the list of processes
  3. Right-click Windows Explorer and select Restart

    Restart Windows Explorer process
    Restart Windows Explorer process

If you are using Windows 8.1, Windows 7 or earlier, you should follow the steps below:

  1. Open Windows Task Manager (Ctrl + Shift + Esc)
  2. Under the Processes tab, find Windows Explorer in the list of processes
  3. Right-click Windows Explorer and select End Task.
  4. From the File menu, select Run new task
  5. Enter explorer.exe in the text field and click Ok.

    Run new task from Task Manager
    Run new task from Task Manager

This will start Windows Explorer again. After restarting, try deleting, moving or renaming the file. If you still get access denied, move on to the next solution.

If these steps resolve your issue and you get this issue frequently, you should launch file explorer processes in separate windows. This will make sure that you don’t lose your work just because one file is stuck and you have to restart the Windows Explorer process.

To launch each file explorer process is a separate window, follow the steps below:

  1. Open Windows File Explorer (Windows key + E)
  2. Go to View ribbon tab and click on the Options button.
  3. Go to the View tab and check the following:
    Launch folder windows in a separate process

    launch folder windows in a separate process
    launch folder windows in a separate process

This makes sure that only the problematic Windows Explorer process gets closed or restarted.

End process using the Task Manager

If you know that it is not Windows Explorer and another specific process is locking the file, you can simply go to Task Manager, select the process and press the delete button. This will kill the problematic process. If still files access is denied, try the next solution.

Restart the computer

When nothing works, restarting the computer can be beneficial. If you don’t get this problem frequently, try restarting your computer. A clean boot is preferable because it will not cache anything in the memory.

If you still can’t delete a file, probably a system process is locking up the file and you will need third-party file unlocker tools discussed below.

Using third-party tools to unlock a file or folder

Microsoft Process Explorer

Microsoft Process Explorer is an advanced task manager. It not only lists the processes running on your computer but also the files or handles they have opened. To find which process is locking a specific file, follow the steps below:

  1. Download Microsoft Process Explorer.
  2. Unzip the downloaded zip file in a folder and run procexp.exe (for 32-but systems) or procexp64.exe (for 64-bit systems).
  3. Go to Find menu and select Find handle or DLL.
  4. Enter the file name which you want to delete/rename/move and press the Search button.
  5. The searching process takes some time but it will list down the program or user which has locked your file.

    Finding file handle in Process Explorer
    Finding the filehandle in Process Explorer

IObit Unlocker

IObit Unlocker is a great tool for unlocking files quickly. Unlocker gives multiple ways to quickly unlock files. You can open the Unlocker window and add multiple files (either by clicking the Add button or drag n drop) to unlock.

IObit Unlocker
IObit Unlocker

Another feature of Unlocker is that it adds a menu item in the file and folder context menu. The user can simply right-click the stubborn file and select IObit Unlocker.

IObit Unlocker in context menu
IObit Unlocker in the context menu

The program will automatically list down the processes locking down the file. You can simply click on the Unlock button to free the file.

Unlock file using IObit Unlocker
Unlock file using IObit Unlocker

If your files get locked frequently, IObit Unlocker is a must-have tool for your system.

LockHunter

LockHunter is another wonderful and free tool to unlock files instantly. It has an intuitive interface where you can select from multiple options like unlock delete, unlock rename, unlock move, etc. It also gives you the option to terminate the locking process instead (sometimes you will need to terminate all related processes before terminating the locking process).

LockHunter also adds a context menu item by the name “What is locking this file?”. You can right-click the file and simply select “What is locking this file?” and LockHunter will come up with multiple options.

LockHunter
LockHunter

You can also use LockHunter from the command prompt. Just follow the command-line instructions from here.

99% of the problems get resolved using the methods given above. If you still have issued deleting your files, please let us know in the comments below and we’ll do our best to give a solution to your specific needs.

Must Read Articles: