Home » How To » Easy Fix for 0x80070091 The Directory is Not Empty Error

Easy Fix for 0x80070091 The Directory is Not Empty Error

The ‘Error 0x80070091: The directory is not empty.‘ is one of the most common errors a Windows can encounter when deleting a file or folder. The error message is pretty cryptic and stops you from deleting the folder. In fact, the problem might persist even after a complete system reboot.

0x80070091 error

There are a few different reasons why you might encounter this error, including file or folder permission issues, the file/folder in use by another application, a corrupted file system, or a problem with your antivirus software. Fortunately, there are several steps you can take to fix the issue and get back to using your computer as normal.

In this quick and easy guide, let’s look at a few sure ways to fix the 0x80070091 error on your Windows computer and delete the target file/folder.

Table of contents:

  1. How to fix the 0x80070091 error
    1. Change ownership of the folder/file
    2. Delete the file/folder using Command Prompt
    3. Use 7-zip to delete the file/folder
    4. Run chkdsk to check and repair the disk
    5. Delete the file/folder from WinRE (Windows Recovery Environment)
  2. Conclusion

How to fix the 0x80070091 error

As I said earlier, there are several reasons why you might get the 0x80070091 error when trying to delete a file or folder. As such, follow the below fixes one after the other. One of them will fix the problem and allow you to delete the file/folder.

1. Change ownership of the folder/file

If file/folder ownership is the cause for the 0x80070091 error, changing the ownership fixes the problem and allows you to delete the target file/folder. Let me show you how.

First, find the file/folder that is causing the error. Next, right-click on it and select the Properties option.

click properties

In the Properties window, go to the Security tab and click on the Advanced button.

click advanced

Next, click the Change link in the Advanced Security Settings for Folder/File.

click change

In the Select User or Group window, type the username in the blank field and click the Check Names button. Next, click on the Ok button.

click check names

Select the ‘Replace owner on subcontainers and objects‘ checkbox in the main window and click on the Ok button. This action changes the ownership of the file/folder to your user account.

Now, you can delete the file/folder without the 0x80070091 error.

2. Delete the file/folder using Command Prompt

If 0x80070091 is blocking you from deleting a file/folder in File Explorer, you can use Command Prompt to delete it. Here’s how to do it.

First, search for Command Prompt in the Start menu and click the Run as administrator option to open it as an administrator.

In the Command Prompt window, run the below commands one after the other.

For folders:

Take ownership of the folder.

takeown /F "D:\full\folder\path" /r /d y

Take full control over the folder.

icacls "D:\full\folder\path" /grant Administrators:F /t

Delete the folder from the Command Prompt.

rd "D:\full\folder\path" /S /Q

For files:

Take ownership of the file. Don’t forget to type the file extension.

takeown /F "D:\full\file\path.exe" /r /d y

Take full control over the folder. Don’t forget to type the file extension.

icacls "D:\full\file\path.exe" /grant Administrators:F /t

Delete the file from Command Prompt.

del "D:\full\file\path.exe"

3. Use 7-Zip to delete the file/folder

7-Zip is a free file compression software for Windows. It allows you to compress, zip, and archive files on Windows. It has a useful feature that forcefully deletes files after compressing. We can use this feature to circumvent the 0x80070091 error. Here’s how.

First, get 7-zip (.exe or .msi) from the official website and install it like any other Windows application.

Download link: https://www.7-zip.org/download.html

Next, hold down the Shift key on your keyboard and right-click on the file or folder. Select the 7-Zip > Add to archive option.

click add to archive

Select the Delete files after compression option in the Add to archive window and press the Ok button.

fix 0x80070091 error using 7zip

This action creates a new 7z or Zip file and deletes the problematic file/folder. Once done, you can delete the newly created compressed file. With that, you’ve solved the 0x80070091: The directory is not empty error.

4. Run chkdsk to check and repair the disk

Sometimes a disk error might be the reason for the 0x80070091 error when deleting a file/folder. If that’s the case, running chkdsk might be helpful. Here’s how to do it.

Launch Command Prompt or Terminal as admin.

Run the below command while replacing DriveLetter with the drive letter of the target drive. i.e., the drive with the file/folder that is causing the 0x80070091: The directory is not empty error.

chkdsk DriveLetter: /x /r

For example, if the file/folder is in the D drive, run the below command.

chkdsk D: /x /r

When prompted for confirmation, type Y and press Enter on your keyboard.

run chkdsk

After that, close the Command Prompt/Terminal window and restart your computer.

On restart, Windows will automatically run the chkdsk tool and fixes any disk errors. After restarting, you can delete the problematic file/folder.

5. Delete the file/folder from WinRE (Windows Recovery Environment)

If the above methods did not work, you can fix the 0x80070091 error and delete the file/folder causing it from the WinRE (Windows Recovery Environment). Here is how to do it.

First, go to the Windows recovery environment screen. To do that, open the Settings app, go to the System > Recovery page, and click the Advanced startup option. Click the Restart button when prompted.

This will restart the computer and shows the Windows recovery environment screen. Here, go to the Troubleshoot > Advanced Options page and click on the Command Prompt option.

Once the Command Prompt window opens, type notepad and press the Enter key on your keyboard.

This action will launch the Notepad application. Here, click the File > Open option.

Next, navigate to the folder where the file or folder is located and select All Files from the Files of Type dropdown menu. Next, right-click on the file/folder, and select the Delete option.

After that, close the Notepad and Command Prompt windows and reboot normally.

With that, you’ve fixed the 0x80070091 error.

Conclusion

The 0x80070091 error can be frustrating, but with the methods outlined above, you should be able to fix the issue and delete or modify the problematic file or folder. As I said earlier, follow each method one after the other, and one of them will fix it for you. For example, in my case, the 7-zip method worked like a charm. On the other hand, I had to follow the Windows Recovery Environment method on my friend’s computer.

All in all, it is pretty easy to fix the 0x80070091: The directory is not empty error.

I hope this simple and easy Windows how-to guide helped you.

If you are stuck or need help, email me, and I will try to help as much as possible.

Leave a Comment

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

Scroll to Top