Low
Operating Systems
✓ Solution Verified by Community (0+ upvotes)
How to fix error error-dir-not-empty in Windows 11
ERROR_DIR_NOT_EMPTY = 145
Fix based on community reports and expert analysis. Last verified: 2026-08-12
· How we verify fixes
| Error Code | error-dir-not-empty |
|---|---|
| Affected System | Windows 11 (Microsoft) |
| Difficulty | Low |
| Estimated Time | 10 min |
Solution Steps
- 1 If you are trying to delete a directory, first empty it. Open File Explorer, navigate to the folder, select all contents (Ctrl+A), and press Delete. Confirm any prompts.
- 2 If the folder is in use, close any programs that might be using it. Use Task Manager (Ctrl+Shift+Esc) to end processes that may have files open in that folder.
- 3 If you are using SUBST and the target directory is not empty, you can still map to it, but you may need to ensure the drive letter is not already in use. The error might be misleading; try using a different drive letter.
- 4 If you need to delete a non-empty folder from Command Prompt, use 'rmdir /s /q C:\path\to\folder' (replace with actual path). The /s flag removes all files and subdirectories, and /q suppresses prompts.
- 5 After cleaning up, retry your original operation. If you were trying to delete, the folder should now be gone. If you were using SUBST, the mapping should succeed.
🔍 Didn't work? Enter your GPU and CPU for hardware-specific advice:
🔧 Still having issues?
Describe your exact problem to Error Buddy and get a personalized fix in seconds.
🛠️ Try Error Buddy — It's Free