Several users reported getting an error Directory is not empty, error 0x80070091 when attempting to delete a folder inside Windows Explorer. Sometimes, you may also see an error message that reads the following –
The directory is not empty," and you can't delete the folder
Though it is stated in the error message that the directory is not empty, the folder may or may not contain any files. In either case, it is not related to whether there are files or not inside a directory but rather the folder itself is corrupt or contains some faulty files inside it.
Related Post: How to Fix System Restore Error 0x80070091 on Windows 11/10
How to Fix Directory is Not Empty, Error 0x80070091
Now that you know what an error 0x80070091 is, and when it occurs, let’s learn the reasons why it appears, and how to overcome this issue.
1. Rename the directory
When you are unable to open a directory, you may either delete or rename that particular directory. However, in case you don’t have the required permission to perform such tasks on a specific folder, you may launch Command Prompt having admin rights and then execute this code on it.
rmdir /s "folder path"
Note: Make sure to replace the folder path in the above command with the exact folder location inside your Windows PC. For example, rmdir /s C:\Users\username\FolderName
.
2. Restart Windows File Explorer
At times, you may resolve such errors by simply restarting the File Explorer. For this open Task Manager by pressing Ctrl + Shift + Esc. Locate Windows Explorer under Processes, right-click on it, and select Restart.
Wait for the File Explorer to launch again and when it does happen, check if you can access the directory without any error code 0x80070091.
3. Use System File Checker
Missing or corrupt system files and folders may also cause an error “The directory is not empty” 0x80070091 on your computer. If that’s the case, you may use System File Checker and initiate the SFC scan over it.
- Launch CMD as administrator first and execute the below code on it.
sfc /scannow
- Wait for the next 10-15 minutes to let this task complete 100%.
After the SFC scan is over, restart your PC, and check if the error 0x80070091 resolves this way.
4. Check for bad sectors in your HDD
The presence of faulty or bad sectors on your hard disk may also result in this “The directory is not empty” error on your Windows PC. Whether your hard disk is corrupt or not, you may confirm the same by running the Check DISK tool.
Here’s how –
- Press Windows + X, and select Terminal (Admin).
- Use Ctrl + Shift + 2 to launch Command Prompt inside the terminal.
- Copy/paste the following on it and press the Enter key.
chkdsk C: /f /r
- If the root drive differs in your case, replace C: with your actual drive letter.
- Since the root drive is already in use, the CHKDSK command will not initiate.
- Instead, this prompts whether you want to schedule the command when your PC restarts.
- Type Y and press Enter.
Close the CMD window and restart your PC. The CHKDSK will soon resume and start inspecting your hard disk. Wait for this scan to complete and when this is over, you will get to know whether your hard drive is OK or not.
Which Services You Can Safely Disable on Windows 11
5. Get the required Permissions and delete the folder
If your hard disk is all good, the 0x80070091 error must be occurring due to not having proper rights over the required folder. Well, in that case, you may get all the required permissions and delete the folder afterward.
- Navigate to the folder containing the directory that is not empty.
- Right-click on the affected folder, and select Properties.
- Go to the Security tab and click Advanced.
- Click Change next to the owner’s name.
- Enter your Windows user account name, Check Names, and hit OK.
- Select “Replace owner on subcontainers and objects.”
- Click Apply and then OK in Advanced Security Settings.
- Click OK to confirm taking ownership of an object.
Close all opened tabs and windows and restart your computer. From the next login, you must be able to delete or rename the directory which was earlier not happening.
Disable Antivirus to Fix Error 0x80070091
Hopefully, the error 0x80070091 must have been resolved by now. If not, this must be due to some security applications interfering with the basic operations in Windows. If that’s the case, you should uninstall third-party antivirus or disable Windows Security (if using it).
In case this does solve the error 0x80070091 on your Windows PC, there must be some malware or viruses on your PC. Well, to resolve the same, you may initiate the Full Scan using Windows Defender or any other antivirus program that you use on your PC.