How to Delete Corrupted and Unreadable Folders in Windows
In this article
To delete a corrupted or unreadable folder in Windows, use Command Prompt with administrative privileges to force removal via the rmdir /s /q command, or take ownership and adjust permissions if access is denied. This achieves permanent deletion of folders that cannot be removed through File Explorer due to file system errors, long paths, or permission locks. First, ensure you have administrator rights and back up any important data elsewhere, as this process is irreversible.
What You'll Need
- Administrator access to the Windows account
- Command Prompt (run as administrator)
- Basic knowledge of navigating to the folder's location via file path
Step-by-Step
- Open Command Prompt as administrator: Press Win + X and select "Terminal (Admin)" or "Command Prompt (Admin)" from the menu. If prompted by User Account Control, click "Yes". Note: Menu labels may vary slightly by Windows version, but the admin option is consistently available.
- Navigate to the parent directory of the corrupted folder. For example, if the folder is at C:\Users\YourName\Documents\BadFolder, type:
cd /d C:\Users\YourName\Documentsand press Enter. The/dswitch ensures the drive changes if needed. - Attempt to delete the folder using the rmdir command: Type
rmdir /s /q "BadFolder"and press Enter. The/sremoves all subfolders and files, and/qenables quiet mode (no confirmation prompts). - If you receive "Access is denied" or "The system cannot find the file specified," proceed to take ownership. First, run:
icacls "BadFolder" /save %temp%\folder_acl.txt /tto back up current permissions (optional but recommended). - Take ownership of the folder and its contents:
takeown /f "BadFolder" /r /d y. The/rflag applies the action recursively, and/d yconfirms prompts automatically. - Grant administrators full control:
icacls "BadFolder" /grant administrators:F /t. This ensures your account has permission to delete. - Now try deleting again:
rmdir /s /q "BadFolder". The folder should now be removed. - If the folder name is too long or contains invalid characters, use the short 8.3 name. First, list short names:
dir /x. Identify the truncated name (e.g., BADFOL~1), then delete it:rmdir /s /q BADFOL~1. - As a last resort, use a Linux live USB (like Ubuntu) to boot and delete the folder from the Windows drive, as Linux handles NTFS permissions differently and ignores Windows locks.
Common Mistakes
- Running Command Prompt without administrator privileges, which results in "Access denied" errors even if you are an admin.
- Forgetting to use quotes around folder names with spaces, causing the command to fail at the first space.
- Using
delinstead ofrmdirfor folders—delonly works on files, not directories. - Not using the
/sswitch, which leaves subfolders intact and causes the command to fail. - Attempting to delete system-protected folders (like Windows or Program Files) without understanding the risk of system instability.
Tips
- Always verify the folder path before running deletion commands—double-check with
dirto confirm you’re in the right location. - If the folder is on an external drive, ensure it’s properly connected and not write-protected via a physical switch.
- After deletion, run
chkdsk /fon the drive to check for underlying file system errors that may have caused the corruption. - For folders with Unicode or reserved names (like those ending in a space or period), the
dir /xmethod with short names is often the most reliable. - Consider using third-party tools like Unlocker or Process Explorer only if you’re certain they’re from trusted sources, but prefer built-in Windows methods for safety.
Troubleshooting
If the folder still won’t delete after trying the above steps:
- Check if a process is using the folder: Open Task Manager (Ctrl + Shift + Esc), go to the Details tab, and look for any program that might be locking files. End the task if safe, then retry.
- Boot into Safe Mode: Restart, hold Shift while clicking Restart, then navigate to Troubleshoot > Advanced Options > Startup Settings > Restart. Press 4 or F4 to enable Safe Mode. Try deletion there, as fewer background processes run.
- If the drive shows I/O errors, it may be failing. Back up accessible data immediately and run the drive manufacturer’s diagnostic tool.
- For persistent issues, the folder might be a junction point or symbolic link causing a loop. Use
dir /alto list such links and remove them withrmdirif safe. - As a final option, back up data and reformat the drive—but only if the data is non-essential and you have recovery media.
Frequently Asked Questions
Will deleting a corrupted folder harm my system?
Only if the folder is part of the Windows operating system or a critical program. Avoid deleting folders in Windows, Program Files, or Users\All Users unless you’re certain they’re safe to remove.
Can I recover a folder after using rmdir /s /q?
No—this command permanently deletes the folder and its contents. Recovery is only possible with specialized data recovery software immediately after deletion, and success is not guaranteed.
What does "The filename or extension is too long" mean?
Windows has a maximum path length of 260 characters. If a folder’s full path exceeds this, standard tools fail. Using the short 8.3 name (dir /x) bypasses this limit.
Is it safe to delete folders in use by antivirus software?
No—temporarily disable your antivirus (if you understand the risk) or boot into Safe Mode to avoid interference. Never delete files while real-time protection is actively scanning them.
Why does the folder reappear after I delete it?
This usually indicates a syncing service (like OneDrive, Dropbox, or Google Drive) is restoring it. Pause syncing, delete the folder, then resume.
Can I use PowerShell instead of Command Prompt?
Yes—PowerShell offers Remove-Item -Path "BadFolder" -Recurse -Force, which works similarly. Run PowerShell as administrator for the same effect.