There are many problems or errors that the windows powered users come across while working the computer help-desk. One of the common issues is the one which involves folders not deleting properly. Whenever your system gets affected with this error, an error message appears that says, “Cannot Delete foldername: Error The directory is not empty. “

This shows an error code message like,

The Directory is Not Empty

Table of Contents

Causes of Error The Directory is Not Empty Windows Issue:

  • This error generally occurs when you try to delete a folder from your hard disk, pen drive, or cd.
  • Your computer’s hard drive has bad sectors.
  • Your system has Corrupt or damaged drivers.
  • Too many junk files in the temporary locations folder can also cause this error.

Similar Types of Error The Directory is Not Empty Windows Issue:

  • the directory is not empty python
  • the directory is not empty PowerShell
  • how to delete error 0x80070091 the directory is not empty
  • cannot remove directory not empty Linux
  • Profile not removed completely. failure – the directory is not empty
  • the directory is not empty vb net
  • the directory is not empty TFS

How to Fix & Solve Error The Directory is Not Empty Windows Issue

As far as we know, this error generally occurs when you try to delete a folder from your hard disk, pen drive, or cd. Before you begin, just try to restart your computer and try and even try to rename the folder. Sometimes, this problem can be fixed just by renaming the folder. However, if you are unable to rename, these suggestions may help you.

1. Run CHKDSK on the Drive –

The first method to remove error 0x80070091 The Directory is Not Empty Error is to perform a check disk scan on the disk that contains the folder that we cannot delete.

  • Open an elevated command prompt (Command Prompt (Admin)).
  • Then you have to type the following command in the command prompt window.
chkdsk c: /F /R
  • After press Enter.

*Note: Press the “Y” key if asked to check your disk the next time your system restarts.

After performing this method of disk checking, you must try to delete the problematic folder or file. If your system is still showing the error or the file is not getting deleted, then you must proceed to the next method.

2. Remove Junk Files –

Sometimes the pile of junk files causes such kind of errors on the drive. To solve the error 0x80070091 The Directory is Not Empty error, and you can try to delete some files.

  • First of all, you have to press the Win + X key to open up the menu.
  • Select “Command Prompt (Admin)” option.
  • After that, you have to click “Yes” to run the command prompt as an administrator.

The Directory is Not Empty

  • Type “cleanmgr” before hitting Enter.
cleanmgr
  • The tool will begin to run automatically and will calculate how much-used space you can claim on the hard disk.

The Directory is Not Empty

  • You must check all the dialogue boxes occupied by unnecessary files, including the temporary files box.
  • After all this, you have to click “OK” to let the tool remove all junk files.
  • If you intend to delete any file or folder, then just attempt this method again to see if the rmdir The Directory is Not Empty c is resolved or not.

The Directory is Not Empty

3. Modify Folder’s (or File’s) Permissions –

It is possible that you may not have the proper right to delete a folder. Make yourself the owner by following the steps below:

  • Click to open Windows Explorer.
  • Then you must open the parent directory of the file or folder you intend to delete.

Modify Folder's (or File's) Permissions

  • After this, you have to right-click on the file or folder before selecting its properties.
  • Click on its security tab> Advanced> Owner.
  • Change the file’s or folder’s ownership to “New Owner. “

The Directory is Not Empty

  • Select “Replace Owner” in both “Sub-container and Objects. “
  • Close before attempting to delete the file or folder to see if the Error The Directory is Not Empty Windows is resolved.

The Directory is Not Empty

4. Rename the WindowsApps folder in WinRE –

Step 1: To begin this step you must boot your Windows 10 into Windows Recovery Environment

  • Firstly you have to open Settings Window by pressing Windows key + I key
  • Then click Update & security.
  • Click Recovery.
  • After all, scroll down on the right side and click Restart now under Advanced startup.
  • Click Troubleshoot > Advanced > Command Prompt.

Rename the WindowsApps folder in WinRE

Step 2: Type the following commands and hit Enter to run them one by one:

cd C:\Program Files
attrib WindowsApps -h
rename WindowsApps WindowsApps.old

Final Step: Reboot your Windows 10, and then rerun System Restore to resolve Windows The Directory is Not Empty Error.

Conclusion:

Although the error may appear as a minor issue at the beginning, it can make it impossible for you to perform some tasks on the computer. Hence, we hope that with the help of the methods shown in this article on how to solve Error The Directory is Not Empty Windows has helped you in getting rid of this error.

In this article, we have told the solution regarding the error, and if it helped you in resolving this Error The Directory is Not Empty Windows, then we would love to know about it, and you can do that by commenting down below.

Leave a Valuable Comment :-