How do I delete a folder that is already in use?

What does it mean for a folder to be ‘in use’?

A folder is considered ‘in use’ if it contains files that are currently open or running. When a program has a file open within a folder, it places a lock on that folder to prevent other programs from modifying or deleting it. As long as the file remains open, the folder lock will remain in place.

According to Microsoft [1], the “Folder in use” error indicates that Windows cannot complete the requested action because the folder contains open files. Attempting to delete, rename, or move a folder that is locked by an open file will result in the “Folder in use” error.

The folder cannot be deleted or otherwise modified until the open files within it are closed. Closing any programs that have files open in the folder will release the lock and allow the folder to be deleted.

Determine which files are using the folder

To determine which files are currently using the folder you want to delete, there are a couple methods you can try:

First, open Task Manager by right-clicking on the taskbar and selecting it from the menu. Look under the Processes tab and see if any running applications or processes seem related to files that might be in the folder. This can give you a good idea of what programs have connections to the folder.

You can also use the Handle tool from Sysinternals to search for open handles associated with the folder path. Run the Handle command from an elevated Command Prompt, inputting the folder path as an argument. This will list any open files handles, registry handles, etc. that are tied to that location. Checking through the results can show you exactly which files within the folder are currently in use.

Once you know which specific files are still open, you can then try to properly close them so the folder itself is fully available to be deleted.

Close any open files in the folder

Before deleting a folder, it’s important to close any open files that are using that folder. This includes both open applications associated with the folder, as well as any background processes that may be accessing files in that folder.

To close open applications, first check the taskbar and system tray for any apps that may have files open in the target folder. Right-click each app icon and select “Close” or “Exit” to properly shut them down. If you have Microsoft Office applications open, such as Word or Excel, make sure to close the entire application rather than just the individual documents.

You can also use the Computer Management utility in Windows to view and close open file handles. Open Computer Management (compmgmt.msc), navigate to System Tools > Shared Folders > Open Files, right-click the open folders and files, and select “Close Open Files.” This will terminate any processes with handles on those files [1].

For background processes that Computer Management doesn’t detect, you may need to manually end associated tasks in the Task Manager. Sort the Task Manager processes by folder path to identify any related to the folder you want to delete. Then right-click those processes and select “End task” to close them.

Once all open files and applications are closed, you should be able to safely delete the folder without errors or conflicts.

Restart your computer

Restarting your computer will forcefully close all open applications and running processes, releasing any files or folders that were in use. This is often the easiest solution if a folder appears to be stuck “in use” and you’re unable to delete it through normal means

When Windows restarts, it completely wipes the RAM (memory), clearing out any processes or tasks that were running in the background. The next time the operating system boots up, it starts with a clean slate. This should release the lock on the troublesome folder so you can then go in and delete it.

Simply click the Start menu and select “Restart.” Alternatively, you can press Ctrl + Alt + Delete to bring up the lock screen options and select “Restart” from there. Either method will restart the computer and close all open apps and processes.

After the reboot completes, try deleting the folder again through File Explorer. With all applications and processes stopped, you should now be able to remove the folder successfully.

According to Super User, restarting your PC will terminate any unresponsive or stubborn processes that refuse to close normally. This clears the way for you to delete locked folders.

Source: https://superuser.com/questions/16789/how-to-automatically-kill-and-restart-a-specific-windows-application-if-it-begin

Unlock the Folder

One way to delete a folder that is in use is to unlock it first. The folder may be locked because a program has files open within it. Utilities like Unlocker and Handle can help force close any processes that are locking the folder.

These tools will enumerate any open handles that have a lock on the folder. You can then select the handles and force them to close. This will release the lock and allow you to delete the folder. Handle and Unlocker provide an easy way to unlock folders without having to dig into Process Explorer to find the offending processes.

Delete system restore points

A key reason a folder may seem to be “in use” is that a system restore point is holding an open handle to the folder or files within it. System restore points create periodic snapshots of your system to allow rolling back to an earlier state if needed. However, this means the files and folders are kept open by the restore point process.

To fully free up the folder and allow deletion, all system restore points holding references need to be deleted. This can be done in Windows by navigating to Control Panel > System > System Protection > Configure and then selecting “Delete” under Restore Settings. Be aware this will delete all system restore points except the most recent one [1].

With no restore points holding handles open, you should then be able to delete the folder successfully.

Take ownership of the folder

One way to delete a folder that is in use or access denied is to take ownership of the folder. This can be done using the TakeOwn utility in Windows. As explained on the Microsoft Support site (“Access Denied” or other errors when you access or work with files and folders in Windows), the TakeOwn tool allows you to take ownership of files, folders, and registry keys.

To use TakeOwn to take ownership of a stuck folder:

  • Download and install the TakeOwn utility.
  • Right-click on the folder and select “Take Ownership” from the context menu.
  • Click Yes to confirm taking ownership of the folder.

Once you have taken ownership of the folder, you should then be able to delete it. Taking ownership gives you full control over the folder, overriding any previous permissions. Just right-click on the folder and select Delete.

The TakeOwn utility provides a simple way to take ownership of files and folders in Windows, enabling you to delete stuck folders by taking control of them. After taking ownership, the folder can be deleted normally.

Delete Folder in Safe Mode

One way to delete a folder that is in use is to restart your computer in Safe Mode. Safe Mode loads only the essential drivers and services, so fewer processes are running. This means the folder may no longer be in use when in Safe Mode.

To delete the folder in Safe Mode:

  1. Restart your computer and press F8 before Windows loads to access the Advanced Boot Options menu.
  2. Select “Safe Mode” and press Enter.
  3. Once in Safe Mode, open File Explorer and navigate to the folder you want to delete.
  4. Right-click on the folder and select “Delete”. [1]
  5. The folder should now delete successfully.

With fewer processes and services loaded, Safe Mode prevents applications or processes from locking the folder, allowing you to delete it.

Use Command Prompt

One way to delete a folder that is in use is by using Command Prompt commands like del and rmdir. These commands can sometimes override the “folder in use” errors and force delete the folder.

To delete a folder with Command Prompt, first open the Command Prompt window as an administrator. Then navigate to the folder you want to delete using the cd command. Once you’re in the correct folder, you can use the del command to delete all files and subfolders inside the folder, or use rmdir to just delete the folder itself.

For example:

del C:\MyFolder /s /q will delete everything inside C:\MyFolder


rmdir C:\MyFolder will just delete the C:\MyFolder directory

The /s and /q options for the del command delete subfolders and don’t prompt for confirmation respectively. This allows you to override any “folder in use” errors and force delete the entire folder contents. Using Command Prompt is often an effective way to delete stubborn folders that you can’t remove through the normal interface. Just be cautious, as these commands permanently delete files.

Source: https://superuser.com/questions/2937/how-do-i-delete-a-folder-thats-in-use

Reboot into a Recovery Environment

One method to delete a folder that is in use is to reboot your computer into a Recovery Environment (RE). The Recovery Environment is a special startup mode in Windows that loads only the bare minimum processes and drivers needed to access your hard drive. This allows you to delete files and folders that normally would be locked or in use when Windows is fully booted.

To reboot into the Recovery Environment in Windows 10 and 11:

  1. Open the Start menu and click the Power button.
  2. Hold down the Shift key while clicking Restart.
  3. After your computer restarts, you’ll see the Recovery Environment menu. Click Troubleshoot.
  4. Select Advanced options > Command Prompt.
  5. In the Command Prompt window, type the command to delete the folder you want to remove. For example: rmdir /s /q C:\FolderName

Because the Recovery Environment loads minimal processes and drivers, it can often delete folders and files that are stubborn to remove from within Windows itself. Rebooting to the RE is a useful trick to delete folders that appear to be “in use.” Just be sure you actually want to delete the folder, as recovery or system folders could cause issues if removed.

Leave a Comment