You delete a folder, Windows says it will be moved to the Recycle Bin, and then it stops with `0x80070091: The directory is not empty.` But the folder looks empty — nothing shows inside. Something in there refuses to be deleted: a hidden file, a locked item, or a damaged entry that only the command line can see and remove.
Quick steps
- Show hidden files and check what is really inside
- Close any program that has files open inside it
- Force delete with rmdir /s /q from a terminal
- Use the robocopy /MIR empty-mirror trick for stubborn folders
- Run chkdsk if the delete keeps failing on the same drive
- Try the delete in Safe Mode as a last resort
Things you'll need
- The folder that refuses to delete
- A terminal, Command Prompt or PowerShell
- An administrator account if the folder is system-owned
- A few minutes of patience for the robocopy mirror method
Step-by-step
Method 1 of 3: See What Is Really Inside
Download image
Step 1: Show Hidden Files and Folders
Explorer hides files by default, and a hidden file inside the folder is the most common reason a delete reports not-empty. Open File Explorer, go to `View > Show > Hidden items`, and tick it. Reopen the folder. Whatever appears inside is what is blocking the delete.
Download image
Step 2: Check the Folder in a Terminal
The command line shows everything: run `dir /a "C:\Path\To\Folder"`. The `/a` flag lists hidden and system entries alongside normal ones. Compare it against what Explorer showed. Anything listed here is the leftover the delete is complaining about — and now you know its name.
Download image
Step 3: Look for a File That Is Locked Open
A file inside the folder that a program has open cannot be deleted, and its presence makes the whole folder undeletable. Open Resource Monitor, search the folder path in Associated Handles, and note which process is holding something inside it. Close that program before deleting again.
Download image
Step 4: Check for Read-Only or System Attributes
Files marked read-only or system resist deletion even when visible. Run `attrib "C:\Path\To\Folder\*.*"` to list the attributes of every entry inside. Anything flagged R or S needs its attribute cleared before the delete — the next method handles that with one command.
Download image
Step 5: Try the Delete Once More After Closing Apps
Before forcing anything, close every open program and retry the delete. A file that was locked a moment ago may now be free. If it still reports not-empty with nothing visible inside, the leftover is hidden, locked, or damaged — and it is time to remove it forcefully.
Method 2 of 3: Force the Delete From the Command Line
Download image
Step 6: Force Delete With rmdir /s /q
Open a terminal and run `rmdir /s /q "C:\Path\To\Folder"`. `/s` removes everything inside, `/q` skips the confirmation prompts. This deletes files Explorer refuses to touch, including hidden ones. If the folder is large, give it a moment — there is no progress bar, just silence until it finishes.
Download image
Step 7: Clear Attributes Before Deleting
If rmdir still fails, strip the protective attributes first: `attrib -r -s -h "C:\Path\To\Folder\*.*" /S /D`. The flags remove read-only, system, and hidden attributes from every entry inside. Run `rmdir /s /q` immediately after, and the delete completes because nothing inside is protected anymore.
Download image
Step 8: Use PowerShell's Remove-Item -Force
PowerShell offers the same force with clearer errors: `Remove-Item "C:\Path\To\Folder" -Recurse -Force`. `-Recurse` deletes the contents, `-Force` overrides read-only and hidden flags. Any error it prints names the exact entry blocking the delete — handle that one and run it again.
Download image
Step 9: Delete the Stubborn Entry by Its Short Name
Some damaged entries cannot be addressed by their normal name. Run `dir /x` in the parent folder to get the 8.3 short name — something like `FOLDER~1` — then delete with the short name: `rmdir /s /q FOLDER~1`. The short name bypasses the damaged long-name entry that was blocking everything.
Download image
Step 10: Empty It With the Robocopy /MIR Trick
For a folder that refuses every delete, mirror nothingness into it: create an empty folder with `mkdir C:\empty`, then run `robocopy C:\empty "C:\Path\To\Folder" /MIR`. `/MIR` mirrors the empty folder over it, deleting every leftover inside. Then `rmdir "C:\Path\To\Folder"` works because it is finally, genuinely empty.
Method 3 of 3: Fix the Drive When Deletion Keeps Failing
Download image
Step 11: Run chkdsk on the Drive
When deletes fail repeatedly on the same drive, the file table has damaged entries that report phantom contents. Run `chkdsk D: /f` on the drive in an elevated terminal — add `/r` on an external drive. After the scan and a reboot, the phantom entries are gone and the folder deletes normally.
Download image
Step 12: Delete It in Safe Mode
Safe Mode runs without the third-party processes that lock files. Hold Shift and click Restart, choose Troubleshoot > Advanced options > Startup Settings > Restart, then press 4. Delete the folder there. With no background apps running, whatever was holding the leftovers is gone, and the delete succeeds.
Download image
Step 13: Check That the Drive Letter Has Not Moved
If you are deleting through a script or shortcut, confirm the folder's drive letter still matches. External drives get reassigned, and a delete pointed at the old letter reports errors that look like content problems. Open Disk Management, confirm the current letter, and run the delete against the real path.
Download image
Step 14: Take Ownership When Permissions Block the Delete
A folder owned by another account or by the system refuses deletion from your session. In an elevated terminal, run `takeown /f "C:\Path\To\Folder" /r /d y`, then `icacls "C:\Path\To\Folder" /grant administrators:F /T`. Both complete silently. The folder now belongs to your administrators group and deletes cleanly.
Download image
Step 15: Stop the Process That Re-creates the Folder
A folder that reappears after every successful delete is being recreated by a running program — a log folder, a cache, a sync target. Watch Task Manager while you delete, and note which process touches it. Close or uninstall that program, then delete. The folder stays gone this time.
Tips
- 0x80070091 always means something is inside — hidden, locked, or damaged. dir /a shows you what Explorer cannot.
- The robocopy /MIR empty-mirror trick clears any folder, no matter how damaged its contents. Keep it in your toolkit.
- Clear attributes before force-deleting. Read-only and system flags are the silent blockers.
- A folder that comes back after deletion is being recreated by a running program — find the program, not the folder.
Warnings
- rmdir /s /q deletes everything inside with no confirmation and no Recycle Bin. Check the path twice before running it.
- Take ownership only of the folder you mean to delete — never of system folders like C:\Windows.
- Do not interrupt chkdsk once it starts scanning sectors.
- Safe Mode deletes are permanent the same way. Confirm the folder before deleting it there.
Frequently asked questions
The folder looks empty. Why does Windows say it is not?
Because something inside is hidden, locked by a running program, or a damaged directory entry that only reports itself at delete time. Run dir /a in a terminal — it lists every entry, including the hidden and system ones Explorer does not show.
What is the robocopy /MIR trick?
Mirror an empty folder into the stubborn one: mkdir C:\empty, then robocopy C:\empty "C:\Path\To\Folder" /MIR. Mirroring deletes every leftover inside, leaving the folder genuinely empty — and then it deletes without protest.
Is it safe to delete in Safe Mode?
Yes, and it is the cleanest way when a background process holds something inside the folder. Safe Mode runs without third-party services, so whatever was locking the file is not running. Delete it there and boot back normally.
Why did the folder reappear after I deleted it?
A running program recreates it — a log folder, a cache directory, a sync target. Deleting the folder treats the symptom. Find the process that touches it in Task Manager and close or uninstall it, then delete.
References
- Microsoft Learn — System Error Codes 0–499 (0x80070091, ERROR_DIR_NOT_EMPTY). https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
- Microsoft Learn — robocopy command reference. https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy
- Microsoft Learn — attrib command reference. https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/attrib
- Microsoft Learn — takeown command reference. https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/takeown
- Microsoft Learn — chkdsk command reference. https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/chkdsk
Every guide is reviewed against its sources. See our editorial policy.
Reader comments
0 so farFinished this guide? Tell other readers what worked, what didn't, and what you would change.