The “Directory is not empty” is a typical File Explorer error that you may encounter while deleting a file or a folder on Windows. It hinders you from deleting a file or folder and can appear out of the blue on your device. Sounds annoying, for sure! Wondering how to fix this error via simple troubleshooting? You’ve come to the right place.
In this post, we have listed a variety of workarounds that you can use to resolve the directory is not empty error code 0x80070091 on Windows 11.
Let’s get started and learn about these potential fixes.
Also read: How To Fix Remote Desktop Authentication Error on Windows 11
What Causes the “Directory not Empty” Error on Windows?
The “Directory is Not Empty” error on Windows occurs when you try to delete a folder that still contains files or sub-folders. The error message appears to prevent the accidental deletion of important data. When Windows considers the folder to be already in use because some of its contents are still open or in use by another process then it may throw you the error. For example, a file within the folder that you are trying to delete may be opened in an application or used as a shortcut somewhere.
You may also encounter this error when the contents of the folder are marked as read-only. Hence, you won’t be able to delete the folder unless you remove the read-only attribute. Try these below-listed solutions to get rid of the error.
How to Fix the “Directory is not Empty” Error on Windows 11?
Solution 1: Delete the Folder Using the Command Prompt
If you are unable to delete a folder using the conventional method then you can also use Command Prompt instead. Use the Command Prompt to delete a file or a folder on Windows with the help of the “rmdir” command. Here’s what you need to do:
Step 1: Tap on the search icon placed on the Taskbar, type “Command Prompt” and then click on the “Run as administrator” option to launch the app in admin mode.
Step 2: In the Terminal window, you can use the rmdir command to delete a file or folder. The syntax of the command goes like this:
rmdir /s “Folder Path”
Step 3: For example, if you want to delete a file stored in the C: folder then you can type:
Rmdir /s “C:\users\Foldername\TestFile”
Step 4: And that’s it! You can delete any file or folder by using this command on Windows.
Also read: How To Fix Input Signal Out of Range Error on Windows 11
Solution 2: Close All the Applications
Make sure that you close all the applications and windows that are in use. Reboot your device, launch the File Explorer app, try deleting the file, and check if the issue still persists.
Solution 3: Restart the File Explorer App
Step 1: Press the Control + Shift + Escape key combination to launch Windows Task Manager.
Step 2: In the Task Manager window, switch to the “Processes” tab, and look for “Windows Explorer”.
Step 3: Right-click on it and select “Restart”.
Solution 4: Run an SFC Scan
SFC (System File Checker) is an in-built Windows utility that scans and replaces corrupt system files on your device. To run the SFC scan on your Windows PC, follow these steps:
Step 1: Launch Command Prompt in admin mode.
Step 2: In the Terminal window, type the following command and hit Enter:
sfc/scannow
Step 3: The scan may take several minutes to complete, and it will automatically repair any corrupt or missing system files it finds.
Also read: How To Fix Unknown Bluetooth device error in Windows 11/10
Solution 5: Run a Disk Scan
The CHKDSK (Check Disk) command on Windows help to resolve various problems related to the file system, such as file corruption, bad sectors, cross-linked files, and lost disk clusters. To run a disk scan on Windows 11, follow these quick steps:
Step 1: Open Command Prompt and run the following command:
Chkdsk /f /r c:
Note: The “/f” option tells CHKDSK to automatically fix any disk errors it finds on your device.
Solution 6: Remove the Read-Only Attribute
If the folder or its contents are marked as read-only, you need to remove the read-only attribute to delete it.
Step 1: If the file or any of its contents are marked as read-only then Windows may throw the “Directory is not empty” error.
Step 2: To remove the read-only attribute, right-click on the folder, select “Properties,” and uncheck the “Read-only” option.
Conclusion
Here are a few simple yet effective workarounds to fix the “Directory is not empty” error on Windows 11. You can try any of the above-listed potential fixes to fix this issue. If these solutions are not helpful then you can use System Restore or try resetting your device.
Was this post helpful? Were you able to resolve the error code 0x80070091? Feel free to share your thoughts in the comments box!