Are you trying to delete a folder or file but couldn’t perform the deletion because of something you don’t know about? The screen continuously shows you “Cannot delete folder, the directory is not empty” or “Cannot delete file. Cannot find the specified source file or disk” or something similar?
Voilà! You’ve just come to the right place.
According to a survey, 87% of individuals have access to a computer in their households. And among them, the Windows 10, 8, 7, Vista, or XP user faces or faces this Cannot Delete a File or Folder error in their Windows.
So, Why can’t I delete a folder?
You can’t delete a folder because it is corrupted or it is in the read-only mode. Besides, the issue can be occurred due to the disk being write-protected, other programs or system processes using the file. And sometimes you’re not allowed to delete some files too.
Whatever the reason behind your problem, tag along, read till the end and apply the below-mentioned 100% working methods to resolve your issue.
Also read, Windows 11: An Error Occurred While Creating the Directory
Quick Navigation hide
How to Fix Error “Cannot Delete Folder, The Directory is not Empty”
Method 1: Modify Folder’s Permission
Method 2: Chkdsk Scan
How to Fix Error 0x80070091: The Directory is not Empty
Fix 1: Try Windows Recovery Environment
Fix 2: Uninstall the Antivirus
Fix 3: Run System Restore from Safe Mode
Conclusion
How to Fix Error “Cannot Delete Folder, The Directory is not Empty”
Windows is the most widely used computer operating system in the world. According to multiple surveys in 2021, 69.61% of consumers use products that are running Windows every day, more or less, for numerous purposes.
We work with a humongous amount of data and files almost regularly. So we need to download files and create files, which comes with deleting some of them.
But while deleting files or folders, sometimes many of them face they can’t delete a file or folder. I find this error a very bothersome one.
There are different versions of this problem. You may see “Folder Access Denied. You need permission to perform this action”, “Cannot delete file. Cannot read from the source file or disk”, or “Cannot Remove Folder. Cannot find the specified file” on your screen for various reasons.
I will give you the 2 viable solutions, and you can apply them on your PC to resolve this issue. So, don’t waste your time, and start applying them one after another right away.
Related content you should read: Install Active Directory Users and Computers on Windows 11
Here is the functional methods you can follow to solve the “Cannot delete folder, the directory is not empty” problem:
Method 1: Modify Folder’s Permission
If you continuously face problems deleting a particular file or folder, maybe the file or folder has some bugs or write-protected issues. So, you need to modify the folder’s permission to make sure you can delete the file.
Here’s a way how you can modify the folder’s permission:
- Right-click on the folder and select Properties.
- Move to Security and remember the location of the required file, i.e., the object name. Click Advanced.
- Select Change on the right side of Owner.
- Enter your username, i.e., where the defective folder lies in the Enter the object name to select
- Go to File Manager and locate the file destination. In my case, I know the file lies in the HP folder.
- Click on Check Names. You’ll see the system detects the file’s exact location and thus clears it out. Click OK. You’ll end up in Advanced Security Settings for Error
- Check on the Replace owner on subcontainers and objects option and click Apply.
- Click OK when a Security prompt pops up.
- Click OK in the Advanced Security Settings for Error window.
Close all the tabs and windows and restart your PC. Try deleting the folder or file again. I believe this time you don’t have to be disappointed. Yet, if you can’t resolve the issue, move to the next one.
You may also like to read: 13 Best Windows 11 Settings You Should Change Right Away
Method 2: Chkdsk Scan
If you can’t delete the required file or folder, you can use the Chkdsk command prompt and thus solve your problem.
Here’s a path you can follow to resolve your “Cannot remove folder, directory is not empty” problem:
- Press the Windows key and type cmd. Click Run as administrator and click Yes to confirm your decision.
- Copy chkdsk c: /F /R and paste in the command prompt. My target file is in the C drive, so I have to write this way. Make sure you change as per as you have to.
- Hit Enter, and you’ll see Chkdsk cannot run because another process uses the volume. Type Y and press Enter.
So, you’ve scheduled it to run the next time you start your PC. So, restart your PC and try deleting the file again. You’ll definitely be able to delete the file this time.
So, that’s how you delete a folder that says the directory is not empty.
Check out our separate post: Windows 11 Remote Desktop Authentication Error
How to Fix Error 0x80070091: The Directory is not Empty
When the error 0x80070091 occurs, it indicates that the directory is not empty. And surprisingly, it can appear in different scenarios. So, you can get confused by the reasons behind you facing this issue.
So, what causes Error 0x80070091: The directory is not empty?
Error 0x80070091: The directory is not empty is caused by corrupted data lying on the file or folder, the external drive is corrupted. Apart from these two major reasons for facing the issue, there might be some missing files causing this problem.
Well, you need to take some steps to settle down the issue. As there are some techniques to follow, I suggest you try one after another.
Here is the required approach you can take to fix the “error 0x80070091: The directory is not empty” issue:
Fix 1: Try Windows Recovery Environment
Using Windows Recovery Environment can be enough to fix the issue. But you have to make precise decisions to finalize the outcome.
Here is a trail you can follow to fix the issue:
- Press the Windows key. Hold the Shift key and choose restart.
- Pick Troubleshoot on the Windows Recovery Environment
- Go to Advanced Options and then System Restore.
- Choose the required Restore Point. Try following the on-screen instruction to finish the process.
Fix 2: Uninstall the Antivirus
Sometimes using an antivirus on your PC can result in Error 0x80070091: The directory is not empty problem. So, you need to uninstall your antivirus and check if the problem stays.
You may also like Enable or Disable Offline Files in Windows 11
Here’s a quick path you can follow to uninstall your Antivirus:
- Tap the Windows key, type Control Panel, and hit enter.
- Choose Programs and then click Uninstall a program.
- Scroll down and find your antivirus.
- Right-click on the antivirus and click Uninstall.
Restart your PC and perform the task again. See if the issue is resolved finally.
Also read, Taskbar Won’t Auto-Hide In Windows 11/10
Fix 3: Run System Restore from Safe Mode
Running system restore from the safe mode can also resolve the Error 0x80070091: The directory is not an empty issue. This option uses a simple interface and more interestingly work on the only app that is required. So, no antivirus can interrupt the system.
Here’s the way you should follow to run System Restore from the Safe Mode:
- Click on the Windows icon and select the Power
- Click on Restart while holding the Shift You’ll end up in the Windows Recovery Environment section.
- Choose Troubleshoot and then pick Advanced Option.
- Click Startup Options and then Restart. So, you have enabled the Safe Mode. Now, you have to run the System Restore.
- Press the Windows key+R to open the Run
- Type exe and tap enter.
- Choose Next and pick the required restore point.
- Select Next and click Finish.
Give your system to finish the process. See if your issue is resolved.
Hence, these are the solution on how to resolve Error 0x80070091: The directory is not empty. Apply them precisely to get the best result.
Read more on how to Password Protect a File or Folder in Windows 11
Conclusion
Cannot Delete Folder: Directory is not Empty is a well-known error Windows user faces globally. There are 2 definite ways you can follow to fix this issue and I recommend you use them individually.
Yet if you fail to perform let me know in the comment section. Besides, inform me if you have additional queries.
FAQs
How do you delete a file that says the directory is not empty? ›
The error “The directory is not empty” may occur when the user tries to delete a directory that is not empty and contains some files or sub-directories. The specified error can be resolved using the “rmdir” command with the option “/s” that will remove the file and folder first, then the main directory.
How do you force delete a folder that won't delete? ›If a file won't delete, selecting it and pressing Shift + Delete keyboard shortcut is another way to erase the data permanently. This file removal method isn't going to pass the Recycle Bin.
How do I fix error delete file or folder? ›Step 1: Open “Task Manager” on your PC by pressing the keys “Ctrl + Shift + Esc.” This is the best shortcut of running Task manager. Step 2: Navigate and search the application, which is using the file you are trying to delete. Click on the “End Task.”
How do I delete a non empty directory in Command Prompt? ›- To empty and remove a directory, type the following: rm mydir/* mydir/.* rmdir mydir. ...
- To remove the /tmp/jones/demo/mydir directory and all the directories beneath it, type the following: cd /tmp rmdir -p jones/demo/mydir.
To remove a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r . Directories that are removed with the rmdir command cannot be recovered, nor can directories and their contents removed with the rm -r command.
How do I delete a corrupted empty folder? ›Find the corrupted file or folder either on the desktop or in your File Explorer. Then, press the Delete or Shift+Delete keys to delete it.
Why is a folder not deleting? ›When you cannot delete a folder, the OS is blocked from responding to your commands. A possible solution for this issue is to restart your system and try deleting the folder again. Another fix for this annoying issue is to use a third-party tool to solve the problem.
How do I delete stubborn files and folders? ›Right-click a stubborn file to erase in File Explorer and select Show more options (for viewing the classic context menu). Select the Force Delete option there to erase the file. Alternatively, you can select an Unlock by ForceDelete option to unlock a locked file in use.
Why I Cannot delete some folder in Windows 10? ›This is because system files and folders are owned by the TrustedInstaller. By default, almost all system files, system folders and even registry keys in Windows 10 are owned by a special built-in user account called TrustedInstaller.
How do I force delete a folder in Windows? ›Method 2: Boot in Windows Safe Mode
To begin, use our guide to boot your Windows 10 or Windows 11 PC into safe mode. Once in safe mode, open File Explorer and navigate to the folder you want to delete. Then, right-click on the folder and select “Delete”. Your folder has been deleted.
How do I fix a corrupted folder on my computer? ›
In the Start menu search bar, search for command prompt and select Run as administrator. Then, type chkdsk x: /f /r and press Enter. Remember to replace x with your drive letter. Windows will now scan the drive and look for any bad sectors, directory errors, lost clusters, and recover data if necessary.
How to delete a file or folder showing error access is denied? ›- When you delete the files or folders by using Windows Explorer, use the SHIFT+DELETE key combination. This bypasses the Recycle Bin.
- Open a command prompt window and then use the rd /s /q command to delete the files or folders.
Force delete folder in Windows 10 with "“RMDIR /S /Q” command: To delete a folder that won't delete in Windows 10, you can type rmdir /s /q E:\test command in Command Prompt window.
What command makes an empty directory? ›Use the mkdir command to create one or more directories specified by the Directory parameter.
How to remove all files in a directory in cmd? ›The del command displays the following prompt: Are you sure (Y/N)? To delete all of the files in the current directory, press Y and then press ENTER.
Which command is used to delete directory that is empty *? ›Use the rmdir command to remove the directory, specified by the Directory parameter, from the system. The directory must be empty (it can contain only .
How do you force delete a folder even if it is open? ›4. In the command window, type the DEL /F file name command and press Enter to force delete the file that is in use.
How does a folder get corrupted? ›File corruption usually happens when there is an issue during the 'save' process. If your computer crashes the file being saved will likely be corrupted. Another cause might be damaged sections of your hard drive or storage media that might have viruses and malware.
Can not delete the file or directory is corrupted and unreadable? ›- Step 1: Remove Corrupted Files and Delete the Folder. Move all the corrupted files to the folder with the locked file. ...
- Step 2: Close Windows Explorer to Erase Corrupted Files. ...
- Step 3: End the Task to Get Rid of Corrupted Files. ...
- Step 4: Restart Your Computer.
Change permissions to be able to delete the folder. So, here you have to get a little confused. Right-click on the desired folder, go to "Properties", open the "Security" section and open the "Advanced" tab. Open the menu item "Owner" and select yourself from the list "Change owner to" and click OK.
How do I force delete a file in Windows 10? ›
The easiest way to force delete a file in Windows is by deleting it using the del /f command in the Command Prompt with administrator privileges.
How do I manually repair corrupted files Windows 10? ›Right-click the Command Prompt and choose "Run as administrator". Step 2. Type: sfc /scannow and hit "Enter". This command aims to find and repair corrupt Windows system files.
Can a corrupted file be repaired? ›A corrupted file is always unusable and inoperable. When facing this issue, you can first try to repair them or try to run a virus detection program. However, if they do not work, you can try a third-party file recovery tool - Recoverit Data Recovery program to help recover corrupted files in Windows.
What causes computer files to become corrupt? ›If your computer loses power or crashes as you save a file, there's a good possibility that the file will become corrupted. Bad sectors on your hard drive or other storage media can also cause file corruption, even if the saving process finishes properly. Viruses and other malware can also cause file corruption.
How do I grant permission to delete a folder? ›Method 2 – Change Permissions
Go ahead and right-click on the folder and choose Properties. Next you want to click on the Security tab and then click on the Advanced button. Now you want to click on the Change Permissions button at the bottom left. Now is the fun part.
Hover over the desired shared folder and click Sharing. Locate the user and click on the Permissions button. Select the appropriate permission settings for the user.
How do you fix you have been denied permission to access this folder? ›Pull up the same Security tab in a folder's Properties box as before. At the top, you'll see a list of users and groups on your PC. Select an entry here, and the bottom panel will show what permissions they have for this folder. Hit the Edit button to change the permissions for each user as desired.
What allows you to delete empty directories? ›rmdir is a command-line utility for deleting empty directories. It is useful when you want to delete a directory only if it is empty, without needing to check whether the directory is empty or not. In this case, you will need to use the rm command or manually remove the directory contents before you can delete it.
How can I tell if a directory is empty? ›To check whether a directory is empty or not os. listdir() method is used.
What are the commands used for creating deleting and changing the directory? ›You make a new directory via mkdir newdirectoryname. You can remove a directory using rmdir directoryname. To remove a directory, you must first remove all the files it contains. To change directories to a directory that is contained in the current directory use cd directoryname.
How do I delete empty folders and subfolders in CMD? ›
First, to force-delete a folder, you can launch the CMD console and navigate to the folder location and use the Del command.
Can T delete is a directory? ›Some files/folders cannot be deleted by you as a user because another user is marked as owner. As administrator you can set yourself as the owner which is called “taking ownership” in IT-lingo. To do this, start by right-clicking on the file or folder and selecting “Properties”.
How do I delete all files in the current non-empty directory including all its non-empty sub directories using only one command? ›- To remove an empty directory, use either rmdir or rm -d followed by the directory name: rm -d dirname rmdir dirname.
- To remove non-empty directories and all the files within them, use the rm command with the -r (recursive) option: rm -r dirname.
02:57 And in order to do it, you need to import shutil and then pass to rmtree() the path to the folder that you want to delete. And this is how you can delete a non-empty folder using Python.
How do I force delete a file in Access Denied? ›- When you delete the files or folders by using Windows Explorer, use the SHIFT+DELETE key combination. This bypasses the Recycle Bin.
- Open a command prompt window and then use the rd /s /q command to delete the files or folders.
In the Start menu search bar, search for command prompt and select Run as administrator. Then, type chkdsk x: /f /r and press Enter. Remember to replace x with your drive letter. Windows will now scan the drive and look for any bad sectors, directory errors, lost clusters, and recover data if necessary.
How to delete all files and folders in a directory cmd? ›- Open the command prompt. Press the Windows key and type 'cmd' to open the command prompt. ...
- Change the path of the directory in cmd. ...
- Use the rmdir command.
os. remove() method in Python is used to remove or delete a file path.
How do I clean up a directory in Python? ›- Use os.rmdir() or pathlib.Path.rmdir() to delete an empty directory.
- use the shutil.rmtree() to recursively delete a directory and all files from it.
The delete() method of the File class is one of the most important methods which is used to delete the files and empty directories represented by the current File object.
How do I give administrator permission to delete a folder? ›
- Take ownership of the folder. Navigate to the folder you want to delete, right-click it and select Properties. ...
- Disable User Account Control. Search uac in the Search box and select Change User Account Control settings. ...
- Activate the built-in Administrator account. ...
- Use SFC. ...
- Use Safe Mode.
To remove world read permission from a file you would type chmod o-r [filename]. To remove group read and execute permission while adding the same permission to world you would type chmod g-rx,o+rx [filename]. To remove all permissions for group and world you would type chmod go= [filename].