How To Fix Error 0x80070091: The Directory is Not Empty

Discussion in 'Error Code Database' started by TechLeopard, May 9, 2018.

  1. TechLeopard

    TechLeopard Administrator Staff Member

    Joined:
    Aug 15, 2017
    Messages:
    72
    Likes Received:
    0
    Trophy Points:
    6
    This guide will look at ways to solve the error code 0x80070091 that occurs when running Windows 10 system restore and when trying to delete files and folders.

    System Restore is a Windows feature that some people get a lot of use out of. It can help to restore the system when something goes wrong with the operating system and you’ve got a system restore point ready. Sometimes this system restore process can get blocked by the 0x80070091 error code, and I may also appear when deleting files and folders. The 0x80070091 can show an error like this when it happens during a system restore:

    System Restore did not complete successfully. Your computer's system files and settings were not changed.

    Details:

    System Restore failed while restoring the directory from the restore point.
    Source: AppxStaging
    Destination: %ProgramFiles%\WindowsApps
    An unspecified error occurred during System Restore. (0x80070091)
    You can try System Restore again and select a different restore point. If you continue to see this error, you can try an advanced recovery method.

    1.png

    Method 1: Rename WindowsApps folder in Safe Mode

    1. Start by booting your machine in Safe Mode
    • Press the Windows key and R to open the Run command
    • Type msconfig into the box and press Enter
    • Open the Boot pane of the pop-up window
    • Choose Safe Boot and press OK
    • Restart the computer when prompted to run Windows 10 in Safe Mode
    2. Press the Windows key and X to open the Quick-Access Menu
    3. Click on Command Prompt (Admin) to run cmd as an admin and click Yes when prompted
    4. Type the following commands into the command prompt and run them one at a time:
    • cd C:\Program Files
    • takeown /f WindowsApps /r /d Y
    • icacls WindowsApps /grant “%USERDOMAIN%\%USERNAME%”: (F) /t
    • attrib WindowsApps -h
    • rename WindowsApps WindowsApps.old
    5. Open System Configuration by following the first two steps of the Step 1 and uncheck Safe Boot to reboot Windows 10.
    6. Run System Restore again after the computer restarts

    Method 2: Renaming WindowsApps folder in WinRE

    1. Boot Windows 10 in WinRE (Windows Recovery Environment)
    1. Open the Settings window by pressing Windows and I and click on Update and Security
    2. Click on Recovery and find the Restart option under Advanced Startup
    3. Choose Troubleshoot > Advanced > Command Prompt
    2. Type the following commands into the prompt and run them one at a time:
    1. cd C:\Program Files
    2. attrib WindowsApps -h
    3. rename WindowsApps WindowsApps.old
    3. Reboot Windows 10 and try running System Restore again

    Error 0x80070091. The Directory is Not Empty

    The 0x80070091 error may occur when you attempt to delete files and folders on Windows with the message: "An 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".

    2.png

    1. Delete the “Windows.old” Folder
    • Right-click on the Start button and choose Run. Type C:\windows\SYSTEM32\cleanmgr.exe into the run box and press OK
    • Windows calculates the amount of space that can be freed on the C: drive. Be patient as the process might take some time.
    • Choose Previous Windows installation(s) from the “Files to Delete” section and click OK
    • Click on Delete Files when asked if you want to permanently delete the files by Disk Cleanup

    2. Remove Junk Files
    Junk files on the computer build up and can cause a number of errors including the 0x80070091 error. Regularly removing these files is a great way to prevent the issue:
    • Press the Windows key and X at the same time
    • Choose “Command Prompt (Admin)”
    • Click Yes when prompted
    • Type “Cleanmngr” and press enter
    • The tool starts to automatically calculate the disk space you can free up on the hard disk. Check the dialog boxes for unnecessary files and the temporary files box
    • Click “OK” and the program will remove these junk files
    • Try to delete the file or folder again and check to see if the 0x80070091 error persists
    3. Own the File/Folder
    There is a chance that you might not be able to delete certain files and folders even when logged into the computer as an administrator. Its therefore necessary to check the properties of these files and folders to see if you own full administrative rights with it.
    • Open Windows Explorer
    • Find the parent directory of the files and folders you want to delete
    • Right-click the file and open its properties
    • Click Security > Advanced > Owner
    • Change the ownership of the file/folder to “New Owner”
    • Choose “Replace Owner” in “Sub-container and Objects”
    • Close the settings and attempt to delete the files/folders again to see if the problem has been solved
    4. Run System File Checker
    Running the systems file checker is a great way to resolve the 0x80070091 error. This tool will scan for corrupt files and attempt to repair them to solve the error.
    • Click Start
    • Type “cmd” into the search box
    • Hold down CTRL + Shift + Enter before clicking on “OK” to open the command prompt
    • Type “chkdsk/f/r” into the prompt and press Enter
    • Type “Y” in response to the notification you get
    • Restart your computer and let the disk check get to work. It will take some time for the tool to finish what it’s doing before you can attempt to delete the files and folders again and check if you have resolved the error
    This should be the final solution for resolving the 0x80070091 error in the event that another of the methods and using system restore fails to get the job done. While it can take some time, this method is beneficial because you’re left with fresh files that don’t have any problems.

    Searches related to 0x80070091
    • erreur 0x80070091
    • erro 0x80070091
    • fehler 0x80070091
    • ошибка 0x80070091
    • errore 0x80070091
    • błąd 0x80070091
    • hresult 0x80070091
    • fout 0x80070091
    • 0x80070091 windows 7
    • 0x80070091 delete folder
    • cannot delete folder 0x80070091
    • 0x80070091 sccm
    • error 0x80070091 windows 10
    • error 0x80070091 external hard drive
    • 0x80070091 solved
     

Share This Page