Yes, the “directory is not empty” error 0x80070091 is solvable. This Windows error typically appears when you try to delete, move, or rename a folder, and it usually means a file inside the folder is locked by a running program or the folder contains hidden system files. The fix involves closing the locking program, using a different deletion method, or clearing hidden attributes.
What Causes Error 0x80070091?
Error 0x80070091 occurs when Windows cannot complete an operation on a folder because it believes the folder is not empty, even though it may appear empty in File Explorer. The most common causes are:
- A file inside the folder is open in another program (e.g., a Word document, a video file being played, or a program’s configuration file).
- The folder contains hidden or system files that are not visible by default.
- File permissions prevent Windows from accessing or deleting certain items within the folder.
- Corrupted file system metadata or a previous failed operation left the folder in an inconsistent state.
- A background process (like antivirus scanning or a cloud sync service) is temporarily locking the folder.
Understanding the cause helps you choose the right fix. The error is not a sign of a failing hard drive; it is almost always a software-level lock or permission issue.
Fix 1: Close Programs and Retry
The simplest fix is to close any program that might be using the folder or its contents. For example, if you are trying to delete a folder that contains a PDF you have open in a viewer, close the viewer first. Also check for background apps like:
- File Explorer windows that have the folder open (close them).
- Media players (if the folder contains video or audio).
- Office applications (if the folder contains documents).
- Cloud sync clients (OneDrive, Dropbox, Google Drive) that might be syncing the folder.
- Antivirus or backup software that might be scanning the folder.
After closing all possible programs, wait a few seconds and try the delete or rename again. This resolves the issue in many cases.
Fix 2: Use Command Prompt to Force Delete
If closing programs doesn’t help, you can use the Command Prompt to delete the folder forcefully. This method bypasses some of the checks that File Explorer performs.
- Press Win + R, type
cmd, and press Ctrl + Shift + Enter to open an elevated Command Prompt (as Administrator). - Navigate to the parent folder of the problematic directory. For example, if the folder is
C:\Users\YourName\Desktop\BadFolder, type:cd /d C:\Users\YourName\Desktop - Type the following command and press Enter:
rmdir /s /q BadFolder
ReplaceBadFolderwith the actual folder name. The/sflag removes all subdirectories and files, and/qsuppresses confirmation prompts.
If the command succeeds, the folder is gone. If it fails with an “Access is denied” message, you may need to take ownership first (see Fix 4).
Fix 3: Use PowerShell with -Force
PowerShell offers a more flexible way to remove stubborn folders. Open PowerShell as Administrator (Win + R, type powershell, press Ctrl + Shift + Enter) and run:
Remove-Item -Path "C:\path\to\folder" -Recurse -Force
The -Force parameter removes hidden and read-only files. If the folder is locked by a process, you might still get an error. In that case, you can combine it with a command to find and kill the locking process, but that is more advanced. A simpler alternative is to use a third-party file unlocker, but be cautious—only download from reputable sources.
Fix 4: Take Ownership of the Folder
Sometimes the error occurs because your user account doesn’t have full control over the folder, even if you are an administrator. Taking ownership can resolve this.
- Right-click the folder and select Properties.
- Go to the Security tab and click Advanced.
- At the top, next to Owner, click Change.
- In the “Enter the object name to select” box, type your username (e.g.,
YourName) and click Check Names, then OK. - Check the box Replace owner on subcontainers and objects and click OK.
- Click OK again on the Properties window.
After taking ownership, try deleting the folder again. If you still get the error, also grant yourself full control: in the Security tab, select your user, click Edit, check Full control, and apply.
Fix 5: Check for Hidden or System Files
Windows may hide protected operating system files. A folder might contain a hidden file (like desktop.ini) or a system file that prevents deletion. To see them:
- In File Explorer, go to the View tab and check Hidden items.
- Also click Options (on the right) > View tab > uncheck Hide protected operating system files (you’ll see a warning—click Yes).
If you find any hidden files, try deleting them first. If they are system files, you may need to take ownership as described above. Be careful not to delete system files that are essential for Windows to run.
Fix 6: Use a Third-Party Unlocker (with Caution)
If all built-in methods fail, a dedicated file unlocker tool can identify which process is locking the folder and release it. Popular options include LockHunter or IObit Unlocker. These tools are generally safe, but always download from the official website and scan the installer with your antivirus. After installing, right-click the folder and choose the unlocker option, then delete the folder.
Note: These tools are not officially endorsed by Microsoft, but they are widely used and effective for stubborn locks.
Frequently Asked Questions
Why does the error say the directory is not empty when it looks empty?
This happens because Windows sees hidden or system files that are not displayed by default. It could also be that a file is open in a background process, so the folder is not truly empty from the system’s perspective.
Can I ignore this error and leave the folder?
Yes, if you don’t need to delete or move the folder, you can leave it. The error is not harmful to your system. However, if the folder is taking up space and you want to remove it, you’ll need to apply one of the fixes above.
Will this error damage my hard drive?
No. Error 0x80070091 is a software-level issue, not a hardware failure. It does not indicate a failing drive. If you experience other symptoms like frequent crashes or data corruption, then you should check your drive’s health, but this error alone is not a warning sign.
Why does the Command Prompt say ‘Access is denied’ when I try to delete the folder?
This usually means you don’t have sufficient permissions. You need to run Command Prompt as Administrator, and you may also need to take ownership of the folder first, as described in Fix 4.
Is it safe to use a third-party unlocker?
Yes, if you download it from a reputable source. These tools are designed to release file locks, but they can also let you delete system files if misused. Always use them only for the specific folder that is causing the error, and avoid deleting anything that looks like a system file (e.g., files in C:\Windows).
What if the error occurs on an external drive?
The same fixes apply. However, if the external drive is formatted as FAT32 or exFAT, you might also want to run chkdsk on it to fix file system errors. Open Command Prompt as Administrator and type chkdsk X: /f (replace X with the drive letter), then try deleting the folder again.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix 0x80070005 DISM Error & the 0x800070005 Typo
- Fix Access Denied Adding Shared Printer in Windows 10
- How to Play Minesweeper: Rules, Tips, and Winning Strategy
- Browser SQL Sandbox for Games: Build Guide
- Snapchat Face Swap: Step-by-Step Guide
- Fix a Computer Chair Height Adjuster: Step-by-Step