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
Also read: How to Install an NVMe SSD in a Desktop and Laptop
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.
Next up, resolve the request is not supported and Windows Error 0x80071160 problems on Windows 11 PCs.
Great article, managed to delete my stubborn venv folder after reading this – thank you!
Thanks! After a lot of research in the internet, this was the only solution to delete my empty folder, which was allegedly not empty !
checkdisk cannot run in readonly mode. how to make my 1 TB external ssd Not readonly please????
Thanks. It works!
Great help…! Thanks a lot…!
The following solution is way more helpful. Just one line command.
Troy Haliwell says
Also works when trying to empty a recycle bin on a non-os drive but it will not delete. Run Admin cmd, chkdsk it, then you can RD it.
This is an older post, but there is a simple solution to removing the Windows.old directory for people who come across this post on the Web. In Windows 7, 8, 8.1, and 10, use Disk Cleanup for the C: drive and choose the option Clean up system files int he bottom left of the Disk Cleanup dialogue box. Check the box that says Previous Windows installation(s) and check any other boxes that you wish to clean up and click ok. Done. If for some reason you still get errors and the directory is not removed, then there is a bigger problem.
Thank you very much. It helped me a lot.
I have tried everything said on this page an other sites and not working. The windows.old folder says not empty and by right clicking it says zero bites. I showed hidden files and still nothing and typing chkdsk the screen blinks and nothing shows up on the desktop to run it. 2.74gbs it said last week. Help!!!
Wow Stan thank you! Had the windows.old folder issue…just created a blank text file at the lowest level and suddenly am able to delete the whole tree of old folders under windows.old.
It helped finally.
I had this windows.old folder after a reset of my PC. Could not delete it even with booting to linux and trying. Full path in the folder pointed to a mozilla profile folder? Added a text file in there and deleted the folder. Once that was gone I could delete the windows.old
Thanks to Stan for the heads up with the fix.
After many useless and frustrating attempts at fixing the “Directory Not Empty” error, I found an obscure post that said they fixed it by creating a new file in the folder that refused to be deleted, So I went down to the bottom level of “Windows.old” directory and plunked a file there. Then I was able to delete that level and proceeded all the way up the rest of tree one at a time. Only took a week to discover this…..which actually started out as “Windows.old(1)”.
Karen Roberts says
I downloaded Avast antivirus and decided to take this off, went to control panel and to remove, A part of it ended up in Program files, called Avast software. I right click on it and another screen pops up saying Error with a bunch of numbers , says directory not empty. How do I get Avast crap off my computer , here as explained.
Frank P Parrinello says
Not working for me – trying to delete OneDrive folder that the OneDrive app refuses to allow to be used, cannot gain access to it to open or delete it. Any other ideas? Thanks!
Win10 User says
Thanks, this helped!
After many different attempts, including doing error checking through the file manager, this simple ancient command prompt command has finally done the trick.
The leftover windows.old folder is finally gone.
Alexey A Zengin says
Yes, it helped. Thank you!
Rebooting was not required on Windows 7 Professional
David Smith says
WIN10 – worked without having to re-boot – Thanks
THANKS ITS WORKS