FIX: The Directory is Not Empty – 0x80070091. (Solved)
If you cannot delete a folder because of error 0x80070091 "The directory is not empty" continue reading below to fix the problem.
Problem in details: When you try to remove a folder, you get that "the folder is not empty", even if it is empty, with error:
1 Interrupted Action
A unexpected error is keeping you from deleting the folder. If you continue to receive this error, you can use the error code to search for help with this problem.
Error 0x80070091: The directory is not empty.
The errors "directory is not empty", "cannot find the file specified", "cannot read from the source file or disk" & "you need permissions to delete a folder/fire", when trying to delete a file or folder, usually indicates a problem with the hard disk, or a permissions problem on the file/folder. To fix these problems, follow the methods below.
How to FIX Error 0x8007009. The directory is empty.
* Note: Before you continue to the methods below, see if you can delete the folder/file in Windows Safe Mode.
- Archive the Folder/File & Delete it.
- Modify Folder/File Owner & Delete it.
- Delete Folder/File with in Command Prompt.
- Check & Repair Disk.
- Delete Folder/File from WinRE.
Method 1. Fix "directory is not empty" by Compressing and Deleting the Folder/File.
The easiest method to remove a folder/file that cannot be deleted, is by compressing it to a archive with WinRAR or the 7-ZIP archiver and deleting it after the compression. To delete a file or folder that cannot be deleted with WinRAR:
1. Download and install WinRAR (if you haven't already) and during installation choose to install the Legacy context menus.
2. Right-click on the folder/file that you cannot remove and select 7-Zip > Add to archive.
2. At Archive parameters, select to Delete files after archiving and click OK. Then, ask YES to confirm your decision.
3. Normally the problematic folder/file will be deleted. Proceed to delete also the created WinRAR archive and you're done!
Method 2. Modify the Owner of the Folder/File and Delete it.
Another method to resolve the issues mentioned in this post, is to change the owner of the folder or file you are having the problem with, and then delete it. To do that:
1. Right click at the folder or file that you cannot delete and select Properties.
2. Select the Security tab and click Advanced.
3. Click Change Owner.
4. Type your account username (e.g. "User2") and click OK.
5. Check the "Replace owner on subcontainers and objects" checkbox and click Apply > OK. Then click OK again to close security settings.
6. Now delete the problematic folder/file.
Method 3. Take Ownership and Delete the Folder/File from Command Prompt.
The next method to solve the problems "Cannot Delete File: The Directory is not empty", "Cannot find the file specified" and "You need permissions to delete the folder", is to change the ownership of the file or folder and then to delete it from Command Prompt.
To Delete a FOLDER that cannot be deleted with Command Prompt:
1. Open Command Prompt as Administrator.
2. Take the ownership permissions of the folder that you want to delete, by typing this command:
- takeown /F "Full_Path_Folder_Name" /r /d y
* For example if you want to delete the folder "C:\Folder1", the command will be:
- takeown /F "C:\Folder1" /r /d y
3. Then give this command to take full control permissions at the folder that you want to delete:
- icacls "Full_Path_Folder_Name" /grant Administrators:F /t
* For this example the command will be:
- icacls "C:\Folder1" /grant Administrators:F /t
4. Finally type the following command to delete the folder:
- rd "Full_Path_Folder_Name" /S /Q
* For this example the command will be:
- rd "C:\Folder1" /S /Q
To Delete a FILE that cannot be delete with Command Prompt:
1. In File Explorer Options uncheck the Hide extensions for known file types.
2. Notice the name of the file that you want to delete and its extension. (e.g. "File1.txt")
3. Now, open Command Prompt as Administrator.
4. Take the ownership on the file that you want to delete, by typing this command:
- takeown /F "Full_Path\Filename.extension"
* For example if you want to delete the file "C:\File1.txt", the command will be:
- takeown /F "C:\File1.txt"
5. Then change the permissions on the file by giving this command:
- icacls "Full_Path\Filename.extension" /grant YourUsername:F
* For example, if your Username is "User2" and want to change the permissions in file "C:\File1.txt", the command will be:
- icacls "C:\File1.txt" /grant User2:F
6. Finally delete the file, with this command:
- del "Full_Path\Filename.extension"
* For example, to delete the "C:\File1.txt" file, the command will be::
- del "C:\File1.txt"
Method 4. Check and Repair Disk.
The final method to fix the error 0x80070091 or to solve other problems when deleting a folder/file, is to check the hard disk for errors and to repair them, using the CHKDSK command. To do that:
1. Launch Command Prompt as Administrator.
2. In the command prompt, type the command below and press Enter.*
- chkdsk X: /x /r
* Where X = the drive letter of the disk with the problematic folder or file. For example, if the folder/file is located on disk "C", the command will be:
- chkdsk C: /x /r
3. If you get the prompt to schedule the disk check the next time the system restarts. Press Y (to select Yes) and restart your device to scan and repair the disk errors.
4. When restarting, let Windows complete the disk checking and repairing process and be patient as it will take a long time.
5. Finally, after entering to Windows proceed to delete the file/folder.
Method 5. Delete Folder/File from WinRE.
If you fail to delete a folder or file using the above methods, restart Windows in Windows Recovery Environment and delete the folder/file from there. To do that:
1. Hold down the SHIFT key on your keyboard and with your mouse go to Power > and click Restart.
2. After restart, go to Troubleshoot > Advanced Options > Command Prompt.
3. In command prompt type notepad and press Enter.
4. From the File menu, select Open.
5. Change the Files of type to All Files and then click This PC.
6. Navigate to the location of the folder/file that you want to delete, right-click on it and choose Delete.
7. Now, right-click on an empty space and choose Refresh to ensure that the folder/file is deleted.
8. When done, close all windows and click Continue to Windows 10.
That's it! Which method worked for you?
Let me know if this guide has helped you by leaving your comment about your experience. Please like and share this guide to help others.
We're looking for part-time or full-time technical writers to join our team! It's about a remote position that qualified tech writers from anywhere in the world can apply. Click here for more details.