Are you trying to delete some unwanted folders from your Windows 11 PC and getting the “Error 0x80070091: The directory is not empty” warning? Do you also see the same error message when trying to delete an empty folder? You can quickly fix the issue and get going with your work by trying the troubleshooting methods mentioned below.
There are many problems I’ve come across while working the computer help-desk. One of the common issues I’ve encountered is one that involves folders not deleting properly. When this issue occurs, an error message appears that says “Cannot Delete foldername: The directory is not empty“.
This problem can happen in Windows 11, 10, 8, 7, and other earlier operating systems. The problem can usually be solved with a chkdsk scan. However, you may also perform other troubleshooting methods if the chkdsk command doesn’t work.
What Is the Directory Is Not Empty Error?
As the name suggests, this is a Windows File Explorer process that stops someone from deleting a folder or directory that might contain important files. Also, if a folder contains .DLL or other runtime files of an app and the app is running, the “Error 0x80070091: The directory is not empty” warning message will pop up. Interestingly, you might see the same error when you’re trying to delete certain folders inside the Windows installation drive.
Reasons Behind the Directory Is Not Empty Error
There are many reasons behind this error but the most important ones are:
- HDD or SSD or NVMe SSD bad sectors in the partition where the folder exists
- An active app is using the content of the folder
- The folder is empty but there are hidden runtime files used by Windows or other apps
How to Fix the Directory Is Not Empty Error in Windows 11
There are many ways to resolve the Error 0x80070091 warning message and delete the folders and files you want to delete on Windows 11. However, there’s no straightforward fix. The resolution is fully dependent on the exact reason the directory is not empty warning when trying to wipe clean some space in Windows 11.
In most cases, the root cause is a file system or directory error in the partition or drive and the chkdsk command should resolve the problem. However, if the issue doesn’t go away after running a chkdsk command, you may need to try other advanced troubleshooting as outlined below. Most of these methods are also valid for Windows 10, 8, 7, Vista, etc., operating systems.
Method 1: Fix Error 0x80070091 by Running CHKDSK:
- Hit Windows + R buttons and type CHKDSK /F inside the Run command box.
Note: If the folder you are trying to delete is located on a drive that is not your C: drive, add the drive letter to the end of the command. Example: CHKDSK /F E:
- Press Enter.
- If you used a drive letter in the command above, you will get a prompt about dismounting the drive. Type Y for Yes and press Enter.
- Most likely, you will get a message like the following:
“Chkdsk cannot run because the volume is in use by another process. Would you like to schedule this volume to be checked the next time the system restarts? (Y/N)”
- Type Y for Yes and press Enter on your keyboard.
- Nothing will happen just yet. You’ll have to restart your computer, to let the scan run. Once the scan is completed, try to delete the folder. You should be able to delete it just fine because CHKDSK has fixed the errors preventing it.
Method 2: Create a New File
You can add a new file inside the folder to remind the Windows system that you got full control over the directory or folder. Simply, go inside the folder and follow these steps:
- Right-click and hover the cursor over the New context menu option.
- It would show several file options. From the list, choose Microsoft Word/Excel Documents.
- Give the newly-created file a random name.
- Now, go back to the parent directory, select the target folder, and press Shift + Delete to erase the folder and its content.
Method 3: Append ! to the Directory Name
You can try a quick workaround which is renaming the folder with an exclamation mark at the beginning. Simply select the folder and press the F2 button on the keyboard. Press the Home key and type the ! mark before the actual folder name. Press Enter to confirm the change. Now, try deleting the folder by pressing Shift + Delete or simply Delete.
Method 4: Delete the Folder Using a Terminal Command
You can force delete the target folder by using a terminal app and executing some commands from the WinRe environment. Follow the steps below:
- Restart the device by pressing the Shift key.
- On the blue screen menu, open a Command Prompt window by following these steps:
Troubleshoot > Advanced options > Command Prompt
- Now, execute the following command inside the terminal:
rmdir /s “folder path”
- You must replace the text folder path with the exact location of the directory or folder you want to delete. For instance:
rmdir /s “C:\Test”
- Hit Enter and the terminal should easily erase the folder and its content.
Method 5: Force Restart the Windows File Explorer Utility
A minor bug or program code issue in the Windows File Explorer tool can stop you from performing related tasks like deleting folders and files. Execute the following steps and then try to delete the target folder:
- Hit Ctrl + Shift + Esc buttons altogether to launch the Task Manager app.
- Under the Processes > Name column header, scroll the list.
- Find Windows Explorer in the list and right-click.
- On the context menu that shows up, click Restart.
- The screen will become black for a few milliseconds.
Method 6: Use the System File Checker Tool
Suppose the folder you want to erase is in the C: drive, you can run the System File Checker tool to fix any file system issues. Then you can attempt to delete the folder. Here’s how you can run the tool:
- Open Command Prompt with administrative rights.
- Now, copy and paste the following command into the terminal app and hit Enter:
- Once the scan is complete, go ahead and try to delete the folder you want to erase.
Method 7: Change the Write Permission of the Target Folder
Though unable to delete issue when you don’t possess the write access, is different. Sometimes, Windows 11 may show the “The directory is not empty” error too. In such a situation, follow these easy steps to fix the write access issue:
- Select the troubled folder and right-click to choose Show more options.
- Now, click Properties and select the Security tab.
- Inside Security, click Advanced, and look at the Owner’s name.
- If it’s not your Windows PC username, then click Change.
- Type your username in the Object name box and click Check Names.
- When a formatted username shows up, click it and select OK.
- Checkmark the Replace owners checkbox as well.
- Click Apply to save the changes.
- Try deleting the folder and this should work just fine.
Method 8: Perform a System Scan Using Microsoft Safety Scanner
Safety Scanner by Microsoft empowers you to hunt down malware and wipe those trouble-makers from your Windows 11, 10, 8, and 7 PC. You can download the app for free using the given links below. Once downloaded, install the app. Run the app and follow on-screen guidance to perform a malware scan. Once the scan is complete, the tool will guide you on how to get rid of any detected malware.
Method 9: Reboot Into Safe Mode
Sometimes Start Up programs and third-party apps may link their processes to certain drives, directories, folders, and files. And Windows 11 won’t let you delete any of these components if any program is already using the storage volume. The best way to fix this is to restart Windows PC in Safe Mode. Here’s how you can do this on your Windows system:
- Open the Start menu and press the Shift key.
- Now, click the power icon and select Restart from several power options.
- Upon the system restart, you should see the WinRe environment, a bluescreen with a few advanced options.
- Choose Troubleshoot and go to Advanced options.
- Select Startup Settings and click Restart.
- Press the number four or F4 on the next screen that shows up after the system restart.
- You should now be in Safe Mode.
- Go to the folder and try to delete it.
- Reboot the PC to go back to normal mode.
Method 10: Perform GUI HDD Error Checking
Online research suggests that many Windows 11 and earlier computer users were able to fix the issue by performing a GUI-based disk checking. Here’s how it’s done:
- Go to This PC or My Computer.
- Select the drive or partition on which the target folder is available.
- Right-click, choose Show more options, and select Properties.
- In the next dialog box, click Tools from the list of tabs.
- Select the Check button under the Error checking section.
- On the warning message that follows, click Scan drive.
These are some of the ways to erase an empty or unwanted folder from your Windows 11 PC when you see the “Error 0x80070091: The directory is not empty” or simply the “The directory is not empty” warning. You must try the methods following the steps mentioned and attempt to delete the folder or directory after completing each method.
Don’t forget to mention below which method worked for you. Also, don’t shy away to comment below if you know any better way to fix the “The directory is not empty” error in Windows PCs.