Force Delete Folder and Files in Windows
In this article
When Windows refuses to delete a file or folder because it's "in use," "open in another program," or you get an "Access Denied" error, a normal delete won't work. This guide shows you several reliable ways to force delete stubborn items, from using built-in tools like Command Prompt to safe third-party utilities. You don't need to be a tech expert—just follow the steps in order.
What You'll Need
- An administrator account (most methods require admin rights).
- The exact name and location (full path) of the file or folder you want to delete.
- If the item is on a network drive or external USB, make sure it's connected and accessible.
- Optional: a third-party unlocker tool if built-in methods fail (links in Tips).
Step-by-Step
Method 1: Close the Program Using the File
- Press Ctrl+Shift+Esc to open Task Manager.
- Look for any program that might be using the file or folder (e.g., Word, Excel, a video player, or an image viewer). Select it and click End Task.
- If you see a process with the same name as the file (e.g., a PDF named "report.pdf" might be open in Adobe Reader), end that process too.
- Try deleting the file/folder again. If it still fails, move to the next method.
Method 2: Use Command Prompt (Force Delete)
- Type cmd in the Windows search bar, right-click Command Prompt, and select Run as administrator.
- To delete a file, type:
del /f /q "C:\full\path\to\file.txt"and press Enter. The/fforces deletion of read-only files, and/qsuppresses confirmation prompts. - To delete a folder and everything inside it, type:
rmdir /s /q "C:\full\path\to\folder"and press Enter./sremoves all subfolders and files,/qruns quietly. - If the path contains spaces, keep the quotes. If you're not sure of the exact path, type
cdto navigate to the parent folder first, then use relative names. - If you get an "Access Denied" error, make sure you're running as administrator and that the file isn't locked by a system process.
Method 3: Use Safe Mode
- Restart your PC and boot into Safe Mode. The easiest way: hold Shift while clicking Restart in the Start menu, then go to Troubleshoot > Advanced Options > Startup Settings > Restart, and press 4 for Safe Mode.
- Once in Safe Mode, locate the file/folder and try deleting it normally (right-click > Delete).
- Safe Mode loads only essential drivers, so many background programs that lock files won't be running.
- After deletion, restart normally.
Method 4: Take Ownership of the Folder
- Right-click the folder or file, select Properties, then go to the Security tab.
- Click Advanced, then next to "Owner," click Change.
- Type your username (or "Administrators") in the box, click Check Names, then OK.
- Check the box Replace owner on subcontainers and objects and click OK.
- Go back to the Security tab, click Edit, select your user, and check Full control under Allow. Click Apply and OK.
- Try deleting the item now.
Method 5: Use a Third-Party Unlocker (If All Else Fails)
- Download a reputable unlocker tool like LockHunter or IObit Unlocker (free versions are fine).
- Install and run the tool. Right-click the locked file/folder and choose the "Unlock" or "Force Delete" option.
- Follow the on-screen prompts. These tools often show which process is locking the item and let you kill it or delete the file directly.
- Restart your PC if the tool asks you to.
Common Mistakes
- Forgetting to run Command Prompt as administrator—without admin rights, you'll get "Access Denied" even for files you own.
- Typing the wrong path—one wrong letter or missing backslash will cause a "file not found" error. Use Tab to autocomplete in Command Prompt.
- Deleting a system file—forcing deletion of critical Windows files can break your OS. Only force delete items you're sure are safe to remove.
- Not closing all instances—a file might be open in a background process like a thumbnail preview or a cloud sync service (OneDrive, Dropbox). Check the system tray for such apps.
- Skipping the recycle bin—force-deleted files bypass the Recycle Bin, so make sure you have a backup if the file matters.
Tips
- Before force deleting, try a simple restart. Often, a lingering process is cleared after reboot.
- If the file is on a network drive, copy it to your local disk first, then delete the local copy.
- Use the
wherecommand in Command Prompt to find the exact location of a file if you're unsure. - For folders that reappear after deletion, check for malware—some viruses recreate files. Run a full antivirus scan.
- If you get a "file is too long" error, the path exceeds Windows' limit. Use the
\\.\prefix in Command Prompt:del \\.\C:\full\pathor use a tool that handles long paths.
Troubleshooting
"Access Denied" Even as Administrator
This usually means the file is owned by another user or the system. Use Method 4 (Take Ownership) first, then try deleting. If that fails, boot into Safe Mode and repeat.
"File in Use" but No Program Shows Up
Some processes run in the background and don't appear in Task Manager's app list. Open Task Manager, go to the Details tab, and look for any process with a high CPU or memory usage that might be related. If you can't identify it, use a third-party unlocker to see which process has the lock.
Command Prompt Says "Cannot Find the Path"
Double-check the path. Use dir to list files in the current directory and verify the name. Remember that folder names with spaces must be enclosed in quotes.
Folder Deletes but Files Remain
This happens when a file inside is locked. Delete the folder with rmdir /s—it will attempt to delete all contents. If it stops, note which file it stops on, close that file, and retry.
Blue Screen or System Crash After Forced Deletion
This is rare but can happen if you delete a driver or system component. Restart your PC, and if it won't boot, use System Restore (if enabled) to roll back. Always back up important data before force-deleting system-related files.
Frequently Asked Questions
Is force deleting safe?
It's safe for user files that are just locked. It's not safe for system files or files that belong to installed programs—deleting those can cause errors or crashes. Only force delete when you're certain the item is unnecessary.
Why does Windows say the file is in use when it's not?
Background processes, like antivirus scans, thumbnail generators, or cloud sync services, may hold a temporary lock on the file. Restarting or using an unlocker usually reveals the culprit.
Can I force delete a file from the Recycle Bin?
Yes. If the Recycle Bin itself is corrupted, you can use Command Prompt with the rd /s /q C:\$Recycle.Bin command, but this will empty the entire bin for that drive. Be careful.
What if the file is locked by a system process like System or svchost.exe?
Those are critical Windows processes. Do not kill them. Instead, try deleting the file in Safe Mode or use a tool like LockHunter to unlock just the file, not the process.
Does force deleting a folder also delete its contents?
Yes, when you use rmdir /s, it deletes the folder and all subfolders and files inside it. There's no undo, so double-check the contents first.
Can I force delete a file that's on a CD or DVD?
No. Optical discs are read-only. You'll need to use a rewritable disc and erase it with disc-burning software, or physically destroy the disc.