According to the Google research result, many computer users have received the error message “the directory is not empty”. But please don’t worry, as this article will offer 5 solutions to solve “cannot remove item the directory is not empty”.

The Directory Is Not Empty

Windows 7 to Windows 10 users will receive the error message “Error 0x80070091 the directory is not empty” in different cases, like deleting a folder, transferring files from an external hard drive, backing up data, etc.

Tip: To transfer files to another drive with ease, you can click here to learn about the operations.

Now, you can try the following solutions that explain “how to delete error 0x80070091 the directory is not empty”, and then do what you want to. 

Substitute: Delete File or Folder via Command Prompt

You can learn how to delete files and folders via Command Prompt respectively after reading the following content. But to be honest, this solution is just a temporary solution that helps delete the unnecessary files or folders.

Please pay attention that you should type different commands in the Command Prompt window to delete files and folders.

Case 1: Delete A Folder

Note: # refers to the full path and the name of the folder that you fail to delete; * refers to the username of the Administrator account.

Step 1: Run Command Prompt as administrator.

Step 2: Please type the following parameters and hit the Enter key on the keyboard after typing each parameter.

  • takeown/F #/r/d y;
  • icals #/grant *:F/t;
  • rd * /S/Q

Case 2: Delete A File

Step 1: Run Command Prompt as administrator.

Step 2: Please type the following parameters and hit the Enter key on the keyboard after typing each parameter.

  • takeown/F #;
  • icacls #/grant *: F
  • del #

After typing all the commands for deleting a file or folder respectively, you can delete them. But this way is not enough convenient, and you can try the following solutions to troubleshoot the issue to delete the unnecessary files with ease.

Solution 1: Rename the Folder

The easiest solution is to see if renaming the folder works. To do that, you just need to do the following 2 steps:

Step 1: If the folder you want to delete is named office docs, please add a hyphen or exclamation character at the end of the file or folder, like office docs!

Step 2: Try to delete or copy the folder.

If you still receive the error message “Error 0x80070091: The directory is not empty” when performing deleting a file or folder, please move to the following solutions.

Solution 2: Check and Fix Bad Sectors

Bad sectors on the hard drive also lead to this error message. Therefore, you need to check the bad sectors and fix them.

Check Bad Sectors for Hard Drive

How to make sure there are any bad sectors on your hard drive? Here we recommend the free third-party software named MiniTool Partition Wizard to check the bad sectors on your hard drive.

This software is a multifunctional toolkit to help you manage your hard drive easily and effectively, like creating partitions, migrating operating system, converting MBR to GPT, and so on.

MiniTool Partition Wizard FreeClick to Download100%Clean & Safe

Here is the tutorial on checking the bad sectors on hard drive with MiniTool Partition Wizard.

Step 1: Download MiniTool Partition Wizard and launch it to get its main interface.

the main interface of MiniTool Partition Wizard

Step 2: Select one hard disk in the Disk Map and choose the Surface Test feature from the left panel.

Note: The Surface Test feature is used to scan each sector status by reading data from the sector. After scanning, disk block without reading error will be marked with green, while the disk block with reading error marked with red. Therefore, in the scan result, you can see at a glance whether there are bad sectors.

click the Surface Test from the left panel

Step 3: After getting the Surface Test window, please click the Start Now button to check the bad sectors on the hard drive.

click the Start Now button in the Surface Test window

Step 4: Wait for the feature to complete the testing.

Step 5: Check the test result. There are two cases:

Case 1: If there are some red squares in the test result, it means that there are some bad sectors on your hard drive and you need to repair them by Command Prompt.

Note: In case of data loss caused by bad sectors on your hard drive, please back up data regularly.

Case 2: If there is no red square, it means the bad sectors are not the cause of this issue, and you can directly seek help for the following solutions.

It is convenient to use MiniTool Partition Wizard Free Edition to check the bad sectors for hard drive.Click to Tweet

Fix Bad Sectors for Your Hard Drive

To fix the bad sectors, you are required to run Command Prompt.

Several steps to fix bad sectors via Command Prompt:

Step 1: Run Command Prompt as administer.

  • Type Command Promptin the Cortana’s search
  • Right-click the first searchingresult and select Run as administrator.

 run Command Prompt as administrator

Step 2: After the Command Prompt window pops up, please type the chkdsk /f /r #: command and then hit the Enter key on the keyboard.

  • Switch /f is to fix the detected problems;
  • Switch /r is to identify the bad sector and recovers information for such sectors;
  • # refers to the drive letter of partition.
Note: After entering this command, your PC will restart and perform the tack. Please do not shut down the machine forcefully.

Step 3: Type Y and hit the Enter key on the keyboard if you are asked to check your disk the next time your PC restarts.

After finishing the whole process, you can try to delete folders or perform other operations to them.

How to Check Hard Drive and Fix the Error? Solutions Are Here!
How to Check Hard Drive and Fix the Error? Solutions Are Here!

Have you ever troubled for by disk error or a partition error? This post will show you how to check hard drive for error and fix them.

Read More

Solution 3: Restart Windows Explorer

Introduced in Windows 95 and later versions, Windows explorer is the file manager which allows users to manage files, folders and network connections, as well as search for files and related components.

In order to fix the situation that you can’t delete a folder in Windows 10, please restart your Windows Explorer.

How to restart your Windows Explorer? Here is the tutorial.

Step 1: Right-click the taskbar on the desktop and select the Task Manager option.

Step 2: After getting the Task Manager window, find Windows Explorer among the options in the Processes tab. Right-click it and then choose the Restart option or select Windows Explorer and then click the Restart button at the bottom right corner of the Task Manager window.

choose the Restart option to restart Windows Explorer

Step 3: Try to delete the folder to check the issue has been solved. If you still receive this error message that the directory is not empty, please move to the following solutions.

Solution 4: Change the File or Folder’s Permissions

Please follow the listed steps to change the file or folder’s permission to delete it.

Step 1: Right-click the folder you cannot delete and choose the Properties option,

Step 2: Select the Security tab and then click the Advanced button.

click the Advanced button in the Security tab

Step 3: After accessing the window like the following image shows, please click Change to change the owner.

click Change to change the owner

Step 4: Type the name of Administrator account in the object name to select box, and then click OK. (Here we take User for example.)

select user for the folder

Step 5: Check the “Replace Owner on subcontainers and objects” checkbox and then click OK and OK again to close the security settings.

If you have changed the permissions of the specified folder and still delete it, the viruses may be the cause of this issue, hence please move to solution 5 to scan your computer for viruses.

Solution 5: Scan Your Computer for Viruses

If you have recently installed some third-party software and started receiving the error message “the directory is not empty” when you delete folders, you need to uninstall such software and scan the full system with a reliable antivirus.

Is Antivirus Necessary for Windows 10/8/7? Get the Answer Now!
Is Antivirus Necessary for Windows 10/8/7? Get the Answer Now!

Is antivirus necessary for Windows 10/8/7 to keep your PC safe? Read this post to get the answer, and you can also know some ways to prevent malware.

Read More

In this situation, we recommend you to use the built-in utility that is Windows Defender Security Center. This utility delivers comprehensive, ongoing and real-time protection against software threats like malware, viruses, etc.

Here is the tutorial on running this utility to scan your computer for the virus.

Note: Before running Windows Defender Security Center to scan your computer for viruses, you should save any open files and close apps and programs in case of data loss.

Stage 1: Scan Your PC

Step 1: Click the Windows icon in the left corner of the desktop.

Step 2: Select Settings, Update & security, and Windows Defender in order.

click the Windows Defender from the left panel

Step 3: Select the Open Windows Defender Security Center button.

Step 4: Select Virus & threat protection and then select Advanced scan.

click Virus & threat protection

Step 5: In the Advanced screen window, select Windows Defender Offline scan and Scan now in order.

After carrying out the 5 steps, Windows Defender will start to check for the virus, and your PC will restart automatically.

Stage 2: View the Scan Result

Step 1: Repeat Step 1 to Step 3 mentioned in Scan Your PC to run Windows Defender again.

Step 2: Select Virus & threat protection and Scan history in order.

Windows Defender Offline scan will automatically detect and remove viruses. Once the viruses have been removed, please try to delete the folder.

How to deal with the error message “the directory is not empty” when you delete a file or folder? Here is an article in which 5 solutions to this issue have been stated in detail. If you are facing this issue now, you can read this article to find the right solutions.Click to Tweet

We Want Your Voice

“Error 0x80070091: The directory is not empty” is a common issue you will receive when you want to delete a file or folder or perform other operations to them. To solve this issue, we have mentioned 6 solutions in this article. Hope all of them can help you solve the issue successfully.

If you have other effective solutions to this issue, please don’t hesitate to contact us via [email protected] or leave your good ideals following this article. Thanks in advance.

If you have any questions about the solutions listed in this article, please let us know, and we are pleasured to answer them to you.

The Directory Is Not Empty FAQ

How do you delete a file that says the directory is not empty?

You can execute some commands in Command Prompt to delete a file when Wi8ndows says the directory is not empty.

  • takeown/F #;
  • icacls #/grant *: F
  • del #

Here # refers to the full path and the name of the folder that you fail to delete; * refers to the username of the Administrator account.

How do I fix error 0x80070091?
  • Rename the folder.
  • Check and repair bad sectors on the hard drive.
  • Restart Windows Explorer.
  • Change the file or folder permissions.
  • Scan your computer for virus or malware.
How do I permanently delete files from my hard drive?
You can use some eraser tool to remove files permanently, like CCleaner. With this tool, you can easily get rid of the files. But if you want to remove all the data on your hard drive, you can try the Wipe Disk feature of MiniTool Partition Wizard.
How do I restore a folder?
If you have mistakenly removed a folder from your computer, you can try the Data Recovery feature of MiniTool Partition Wizard to retrieve it back.
  • linkedin
  • reddit