Try closing any open files or programs using the folder
The most common reason you can’t delete a folder is because a file or program inside the folder is currently open. Before deleting a folder, you need to close any files, programs, or apps that might be using files inside the folder.
Here are some tips for closing open files and programs:
- Close all open window explorer windows, file windows, or other folders inside the folder you want to delete.
- If a Microsoft Office program like Word or Excel is open, close the file. Go to File > Close. This will close the entire program.
- Check the taskbar for any open programs that might be using files in the folder, and close those programs.
- Press Ctrl + Alt + Delete to open the task manager and look for any processes or apps using files in the folder. Select the process and click End task.
Closing open files and programs releases the lock on the folder so it can be deleted. After closing everything, try deleting the folder again. If you still get an error, another program may be locking the folder.
Restart your computer
If closing open files doesn’t work, restarting your computer will force close all programs and clear any locks on the folder.
Here’s how to restart:
- Save any open work in other programs.
- Click the Start button and select Power > Restart.
- The computer will shut down and restart.
- After it powers back up, try deleting the folder again.
Restarting ends any processes that might be locking the folder and gives you a clean slate to delete it.
Use Unlocker to force delete the folder
If restarting your PC doesn’t allow you to delete the folder, you can use a free utility called Unlocker. Unlocker will show you what programs have locks on the folder and let you delete it by force.
Here’s how to use Unlocker:
- Download and install Unlocker from https://unlocker.en.softonic.com.
- Right-click on the folder you want to delete and select Unlocker from the right-click menu.
- Unlocker will scan the folder and show you any lock details. Click the Unlock All button.
- Click Yes to confirm deleting the locked folder. Unlocker will force delete it.
Unlocker is a safe way to remove stubborn folder locks so you can delete the folder. It avoids having to restart the computer when standard methods don’t work.
Check if antivirus software is blocking the delete
Antivirus programs like Windows Defender will sometimes detect a folder delete operation as suspicious and block it. You may get an error that the folder is open in another program when trying to delete.
To allow deleting the folder, you need to temporarily disable your antivirus program:
- Open the Windows Security app.
- Go to Virus & threat protection settings.
- Under Virus & threat protection, toggle Off Real-time protection.
- Try deleting the folder again.
- When done, re-enable Real-time protection.
With antivirus real-time scanning off, you should be able to delete the folder successfully. Remember to turn protection back on after deleting the folder.
Delete the folder from Safe Mode
Starting Windows in Safe Mode loads only the essential drivers and services. This prevents any other programs from locking the folder.
To delete a folder from Safe Mode:
- Access the Windows recovery environment by holding Shift and clicking Restart in the start menu.
- On the recovery screen, select Troubleshoot > Advanced options > Startup Settings.
- Click Restart, and on the startup settings screen press 5 to enable Safe Mode.
- Once in Safe Mode, go to the folder you want to delete and delete it.
- Restart back into normal Windows.
Because Safe Mode has restricted functionality, you can often delete folders that won’t delete in normal mode.
Take Ownership to delete System Files
If the locked folder is in a protected Windows folder like Program Files or Windows, you need to take ownership to delete it:
- Right-click the folder, select Properties, and go to the Security tab.
- Click Advanced, then find the folder owner under Owner and change it to your user account.
- Check the box to Replace owner on subcontainers and objects.
- Click OK until all windows are closed, then try deleting the folder again.
Taking ownership gives you full control to delete protected system folders. Be careful not to delete anything critical to Windows.
Delete on boot with DelinvFile
DelinvFile is a tool that lets you schedule deletion of any file or folder on the next restart. It can often delete locked folders when other methods fail.
To use DelinvFile:
- Download DelinvFile from https://learn.microsoft.com/sysinternals.
- Right-click the folder and select Delete with DelinvFile.
- Check the box to delete the folder on restart and click OK.
- The folder will be deleted after rebooting.
DelinvFile schedules deletion tasks to run before Windows loads any programs that could lock files. This allows deleting stubborn folders.
Conclusion
Deleting a folder in use can be frustrating, but using the right techniques makes it possible:
- Close any open files and programs with locks on the folder.
- Restart your computer to clear any folder locks.
- Use Unlocker to view and remove folder locks.
- Temporarily disable antivirus if it’s blocking the delete.
- Boot into Safe Mode to avoid other programs locking the folder.
- Take ownership of protected system folders before deleting.
- Schedule folder deletion with DelinvFile on next reboot.
With some persistence and using the correct tools, you can overcome folder lock issues and delete any folder, even system and protected ones. Taking the time to properly close programs, restart your PC, and remove locks will ensure you can efficiently manage your disk space.
Additional Questions
What is a folder lock?
A folder lock prevents deleting or modifying a folder because it is open or in use by a running program or process. Windows locks folders to prevent corruption of programs using files inside them.
Why can’t I delete a folder if a file is open?
Windows protects open files by locking their parent folder. This prevents the folder from being deleted or moved while a file is in use. You must close open files before the folder lock is released.
What folder is safe to delete in Windows?
The Downloads, Documents, Music, Pictures, and Videos folders in your user profile are generally safe to delete. Avoid deleting protected system folders like Program Files, Windows, and Users without taking ownership first.
How do I unlock a folder in Windows 10?
To unlock a folder, close any open files inside it. Restart your computer to force close any locking programs. Use Unlocker to view and remove specific folder locks. Taking ownership allows deleting protected system folders.
Why does Windows 10 lock folders?
Windows locks certain folders like Program Files, Windows, and Users to protect critical system files from being accidentally deleted or corrupted. User folders are locked when open to prevent errors or data loss.
Method | Description |
---|---|
Close Open Files | Closes any open files inside the folder so it can be deleted. |
Restart Computer | Forces all programs to close, removing any folder locks. |
Use Unlocker | Utility that shows locks and can delete locked folders. |
Disable Antivirus | Turn off real-time protection if it blocks the delete. |
Safe Mode | Minimal mode that prevents other programs locking the folder. |
Take Ownership | Gives permissions to delete protected system folders. |
DelinvFile | Schedule folder deletion before Windows loads locking programs. |
What is the best way to delete a protected system folder?
The best way is to take ownership of the folder first, then attempt deletion. Right-click the folder, select Properties > Security > Advanced, change owner to your account, check subcontainers and objects, click OK, then delete.
Can I delete Program Files folder in Windows 10?
You should not delete the entire Program Files folder, as it contains Windows system files. But you can delete specific program subfolders after taking ownership of them first. Be cautious to avoid deleting anything important to the OS.
Is it safe to delete Users folder in Windows 10?
No, you should never delete the whole Users folder, as it contains your user profiles. You can delete old unused user profile subfolders within Users if needed.
What is DelinvFile used for?
DelinvFile schedules deletion of files and folders upon restarting Windows. It can often force delete locked folders by running before other programs start.