• Skip to main content
  • Skip to primary sidebar

Technipages

Tutorials and fixes for smartphone, gadget, and computer problems

  • Topics
    • Android
    • Browsers
    • Gaming
    • Hardware
    • Internet
    • iPhone
    • Linux
    • macOS
    • Office
    • Reviews
    • Software
    • Windows
    • Definitions
  • Product Reviews
  • Downloads
  • About
Error “Cannot Delete Folder: The Directory Is Not Empty” Fix

Error “Cannot Delete Folder: The Directory Is Not Empty” Fix

March 13, 2023 by Mitch Bartlett 20 Comments

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:
How to run CHKDSK in Windows 10
How to run CHKDSK in Windows 10
  • 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.
Dismount drive for CHKDSK run
Dismount drive for CHKDSK run
  • 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.
Create a new Word file inside a folder
Create a new Word file inside a folder
  • 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.

Renaming folder with ! to fix Error 0x80070091 The directory is not empty error
Renaming folder with ! to fix Error 0x80070091 The directory is not empty error

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

How to access Command Prompt from WinRe
How to access Command Prompt from WinRe
  • 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”

Deal with The directory is not empty using Terminal in WinRe
Deal with The directory is not empty using Terminal in WinRe
  • Hit Enter and the terminal should easily erase the folder and its content.
Delete folder using command prompt
Delete the folder using the Command Prompt

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.
Restarting Windows Explorer in Windows 11
Restarting Windows Explorer in Windows 11
  • 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:
sfc /scannow
How to run SFC scan on Windows 11
How to run SFC scan on Windows 11
  • 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.
How to check names in Advanced options of Security in Properties menu
How to check names in the Advanced options of Security in the Properties menu
  • If it’s not your Windows PC username, then click Change.
  • Type your username in the Object name box and click Check Names.
Resolve The directory is not empty by editing user permission
Resolve The directory is not empty by editing user permission
  • 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.

  • 32-bit Microsoft Safety Scanner
  • 64-bit Microsoft Safety Scanner

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.
Example of Windows 11 safe mode screen
Example of Windows 11 safe mode screen
  • 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.
GUI HDD Error Checking to fix The directory is not empty warning
GUI HDD Error Checking to fix The directory is not empty warning
  • Select the Check button under the Error checking section.
  • On the warning message that follows, click Scan drive.

Conclusion

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.

You Might Also Like

  • How to Add or Delete Printers in Active Directory
    How to Add or Delete Printers in Active Directory
  • Active Directory: Fix Replication Error 8203
    Active Directory: Fix Replication Error 8203
  • Windows 10: An Error Occurred While Creating the Directory
    Windows 10: An Error Occurred While Creating the Directory
  • What to Do If You Can’t Delete the MountUUP Folder
    What to Do If You Can’t Delete the MountUUP Folder
  • Bitwarden: How to Edit or Delete a Folder
    Bitwarden: How to Edit or Delete a Folder
  • Can't Delete Folder "You have been denied permission" Fix for Windows
    Can't Delete Folder "You have been denied permission" Fix…

Filed Under: Windows

Reader Interactions

Comments

  1. Rosie says

    December 14, 2022 at 3:22 pm

    Great article, managed to delete my stubborn venv folder after reading this – thank you!

  2. David says

    July 8, 2022 at 2:35 pm

    Thanks! After a lot of research in the internet, this was the only solution to delete my empty folder, which was allegedly not empty !

  3. jack says

    June 7, 2021 at 3:12 pm

    checkdisk cannot run in readonly mode. how to make my 1 TB external ssd Not readonly please????

  4. nevim says

    March 26, 2021 at 6:51 am

    Thanks. It works!

  5. Carlos says

    February 4, 2021 at 3:29 pm

    Great help…! Thanks a lot…!

  6. Pavindu says

    October 23, 2020 at 10:14 pm

    The following solution is way more helpful. Just one line command.
    https://stackoverflow.com/a/53687576/8810941

  7. Troy Haliwell says

    January 1, 2020 at 2:07 pm

    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.

  8. KC says

    September 13, 2019 at 11:08 am

    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.

  9. Fernando says

    June 29, 2019 at 6:44 pm

    Thank you very much. It helped me a lot.

  10. James says

    June 20, 2019 at 5:11 pm

    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!!!

  11. Ryan says

    June 18, 2019 at 8:04 pm

    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.

  12. Dr.Saad says

    February 17, 2019 at 3:09 am

    It helped finally.
    Thank you

  13. Seán says

    January 17, 2019 at 9:23 pm

    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.

  14. Stan says

    September 9, 2018 at 12:12 pm

    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)”.

  15. Karen Roberts says

    August 10, 2018 at 5:58 pm

    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.

  16. Frank P Parrinello says

    August 4, 2018 at 6:34 pm

    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!

  17. Win10 User says

    July 1, 2018 at 9:31 am

    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.

  18. Alexey A Zengin says

    December 13, 2017 at 2:14 pm

    Yes, it helped. Thank you!
    Rebooting was not required on Windows 7 Professional

  19. David Smith says

    December 10, 2017 at 1:32 pm

    WIN10 – worked without having to re-boot – Thanks

  20. SAMIT says

    March 23, 2017 at 2:53 pm

    THANKS ITS WORKS

Did this help? Let us know!

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Recent Posts

  • Microsoft Edge Collections: What It is and How to Use It
  • YouTube Premium: How to Disable/Enable Background Playback
  • How to Update Apps on iPad (iPadOS 16.3.1)
  • How to Fix Outlook Rules Are Not Supported for This Account
  • How to Stop Windows 11 Updates
  • How to Change the Themes on Windows 11
  • How to Use Goal Seek in Excel (With Real-Life Examples)
  • How to Use MiniTool MovieMaker for Stellar Video Editing

Who’s Behind Technipages?

Baby and Daddy My name is Mitch Bartlett. I've been working in technology for over 20 years in a wide range of tech jobs from Tech Support to Software Testing. I started this site as a technical guide for myself and it has grown into what I hope is a useful reference for all.

© Copyright 2023 Guiding Tech Media · All Rights Reserved · Privacy