Cannot Delete File or Folder in Windows 11/10 – Complete Troubleshooting Guide for Access Denied, File in Use, Permission and Corruption Errors
A file or folder that refuses to delete is a common Windows problem. You may select an item, press Delete or Shift + Delete, and receive an error such as: Fi...
A file or folder that refuses to delete is a common Windows problem. You may select an item, press Delete or Shift + Delete, and receive an error such as:
- File Access Denied
- Folder Access Denied
- You need permission to perform this action
- You require permission from SYSTEM to make changes to this file
- You require permission from TrustedInstaller
- The action can't be completed because the file is open in another program
- The action can't be completed because the folder or a file in it is open in another program
- Could not find this item
- This is no longer located in...
- The directory is not empty
- The file name(s) would be too long for the destination folder
- An unexpected error is keeping you from deleting the file
- Error 0x80070005 – Access is denied
- Error 0x80070091 – The directory is not empty
- Error 0x80004005 – Unspecified error
The correct solution depends on why Windows is refusing the deletion.
This guide starts with the safest methods and progresses to advanced troubleshooting.
Important: Make Sure the File Should Actually Be Deleted
Before forcing deletion, confirm that the file or folder is not required by Windows or an installed application.
Be especially careful when deleting anything from:
C:\Windows
C:\Windows\System32
C:\Program Files
C:\Program Files (x86)
C:\ProgramData
Windows recovery partitions or system-protected directories
Forcing deletion of system components can cause Windows, applications, drivers, updates, or recovery features to stop working.
If you are unsure what a file does, identify it before deleting it.
Why Can't I Delete a File or Folder?
There are several common reasons.
1. The File Is Currently in Use
A program may have the file open.
Examples include:
- Microsoft Word
- Excel
- Adobe Acrobat
- Media players
- Backup software
- Antivirus software
- File synchronization software
- Database applications
- Web browsers
- Windows Explorer
Windows normally prevents deletion while another process maintains a lock on the file.
2. A File Inside the Folder Is in Use
Sometimes the folder itself is not locked.
Instead, one file somewhere inside the folder is being used by an application.
Windows therefore refuses to remove the entire folder.
3. File Explorer Is Locking the File
Windows File Explorer itself can sometimes maintain a handle to a file, thumbnail, preview, media file, archive, or folder.
This can happen particularly with:
- Pictures
- Videos
- PDF files
- ZIP archives
- Network folders
- Preview Pane
- Thumbnail generation
4. You Don't Have Permission
Windows uses NTFS permissions to determine who can:
- Read
- Modify
- Execute
- Rename
- Delete
a file or folder.
Even an administrator may occasionally encounter permission problems.
5. Another User Owns the File
The file may have been created by:
- Another Windows account
- A previous Windows installation
- Another computer
- SYSTEM
- TrustedInstaller
- A domain account
Your current account may therefore not have sufficient rights.
6. The File Has Read-Only or System Attributes
Some files have attributes such as:
- Read-only
- Hidden
- System
These attributes can sometimes interfere with normal file management.
7. The Filename or Path Is Too Long
A deeply nested folder structure can create paths that certain Windows applications or legacy APIs have difficulty processing.
For example:
C:\Users\User\Documents\Projects\Old Backup\Another Backup\Archive\Very Long Folder Name\...
You may be able to see the file but encounter problems deleting or renaming it.
8. The File System Is Damaged
Corruption in NTFS or another file system can create unusual symptoms such as:
- File exists but cannot be deleted
- Folder appears empty but cannot be removed
- Incorrect file size
- Incorrect filename
- "Directory is not empty"
- "File or directory is corrupted and unreadable"
In these situations, disk/file-system checking may be necessary.
9. OneDrive or Another Sync Program Is Using the File
Cloud synchronization applications can temporarily lock files.
Examples include:
- Microsoft OneDrive
- Google Drive
- Dropbox
- Other backup/synchronization utilities
10. Antivirus or Security Software Is Holding the File
Security software may be:
- Scanning the file
- Quarantining it
- Monitoring it
- Preventing unauthorized modification
Do not disable security software merely to delete an unknown or suspicious file.
Solution 1: Close the Application Using the File
Start with the simplest solution.
Close any program that may be using the file.
For example, if you cannot delete:
Report.xlsx
close Microsoft Excel.
If you cannot delete:
Invoice.pdf
close the PDF reader and any browser tab displaying the PDF.
Then try deleting the file again.
Solution 2: Close File Explorer Preview Pane
The Preview Pane can occasionally cause files to remain in use.
Open File Explorer.
Go to:
View → Show → Preview pane
Turn the Preview Pane off.
You can also use:
Alt + P
Then try deleting the file again.
Solution 3: Restart Windows Explorer
If Explorer itself is holding the file, restart it.
Press:
Ctrl + Shift + Esc
to open Task Manager.
Locate:
Windows Explorer
Right-click it and select:
Restart
Wait for the desktop and taskbar to reload.
Now try deleting the file or folder.
Solution 4: Restart the Computer
Restarting Windows releases most temporary file locks.
Select:
Start → Power → Restart
Do not simply close and reopen File Explorer.
After restarting, try deleting the item before reopening unnecessary applications.
Solution 5: Delete the File Permanently
Normally, Windows sends deleted files to the Recycle Bin.
You can bypass the Recycle Bin by selecting the file and pressing:
Shift + Delete
Confirm the deletion.
Warning
Shift + Delete normally removes the item without placing it in the Recycle Bin.
Use it only when you are certain you no longer need the data.
Solution 6: Check File or Folder Permissions
Right-click the problematic file or folder.
Select:
Properties → Security
Select your Windows account.
Check whether you have permissions such as:
- Full control
- Modify
- Read & execute
- Read
- Write
If your account does not have sufficient permissions, an administrator may need to modify them.
Do not arbitrarily change permissions on Windows system folders.
Solution 7: Take Ownership of the File or Folder
This is particularly useful for files copied from:
- Another PC
- An old Windows installation
- Another user profile
- An old hard disk
Right-click the file or folder and select:
Properties → Security → Advanced
Check the current Owner.
Click:
Change
Enter your Windows username or select an appropriate administrator account.
Click:
Check Names → OK
For a folder containing many subfolders, you may need:
Replace owner on subcontainers and objects
Apply the changes.
After taking ownership, make sure your account has the necessary permissions before attempting deletion.
Important
Do not take ownership of Windows system folders merely because Windows prevents deletion. TrustedInstaller and SYSTEM ownership is intentional for many operating-system components.
Solution 8: Remove Read-Only, Hidden and System Attributes
Open Command Prompt as Administrator.
For a problematic file, run:
attrib -r -h -s "C:\Path\FileName.ext"
Then try deleting it.
For example:
attrib -r -h -s "C:\Users\User\Desktop\OldFile.txt"
For a folder and its contents, attributes can be processed recursively:
attrib -r -h -s "C:\Path\Folder\*" /s /d
Be careful when removing system attributes from operating-system folders.
Solution 9: Force Delete a File Using Command Prompt
If File Explorer cannot remove the file, Command Prompt may work.
Open:
Start → search for Command Prompt → Run as administrator
Use:
del /f /q "C:\Path\FileName.ext"
Example:
del /f /q "C:\Users\User\Desktop\OldFile.txt"
Here:
/f forces deletion of read-only files.
/q uses quiet mode.
Warning
The del command does not provide the same Recycle Bin protection as normal File Explorer deletion.
Verify the path carefully.
Solution 10: Force Delete a Folder Using Command Prompt
To delete a folder and everything inside it:
rmdir /s /q "C:\Path\FolderName"
You can also use:
rd /s /q "C:\Path\FolderName"
For example:
rmdir /s /q "C:\Users\User\Desktop\OldFolder"
/s removes all files and subdirectories.
/q suppresses confirmation prompts.
Warning
This is a destructive command.
Before pressing Enter, verify the full folder path carefully.
Never experiment with rmdir /s /q against Windows, Program Files, user-profile roots, or an entire drive.
Solution 11: Delete Using PowerShell
PowerShell provides another method.
For a file:
Remove-Item -LiteralPath "C:\Path\FileName.ext" -Force
For a folder and its contents:
Remove-Item -LiteralPath "C:\Path\FolderName" -Recurse -Force
-LiteralPath is particularly useful because PowerShell treats the path literally rather than interpreting wildcard characters within the filename.
Again, verify the path carefully because forced command-line deletion may bypass normal Recycle Bin behavior.
Solution 12: Find the Application Locking the File
If Windows says:
The action can't be completed because the file is open in another program
you need to identify the process holding it.
One built-in method is Resource Monitor.
Press:
Win + R
Enter:
resmon
Press Enter.
Go to:
CPU
Locate:
Associated Handles
Use the search box and enter part of the filename.
Resource Monitor may identify the process that currently has a handle open to the file.
Close the related application normally if possible.
Do Not Randomly End System Processes
Processes such as:
- System
- winlogon.exe
- csrss.exe
- lsass.exe
- services.exe
should not be terminated simply to unlock a file.
Solution 13: End a Normal Application from Task Manager
If you identify a normal application that is locking the file:
Press:
Ctrl + Shift + Esc
Open Task Manager.
Locate the application.
Right-click it and select:
End task
Then try deleting the file.
Remember that ending an application can discard unsaved work.
Solution 14: Try Renaming the File First
Sometimes Windows refuses to delete a file but allows it to be renamed.
Right-click it and select:
Rename
Change:
problem-file.ext
to something simple such as:
delete-me.ext
Then attempt deletion again.
This can occasionally help with unusual filenames or application references.
Solution 15: Move the File Before Deleting It
Try moving the problematic file to a simple location such as:
C:\Temp
Then delete it.
This can sometimes help when the original directory structure or application is causing the problem.
Solution 16: Deal with Very Long Paths
If the full path is extremely long, start by shortening the folder structure.
For example, move or rename a high-level folder to something short.
Instead of:
C:\Users\User\Documents\Company Documents\Archived Projects\Old Backup\...
try moving the relevant folder closer to:
C:\Temp
Then delete it.
If File Explorer still fails, PowerShell or Command Prompt may handle the item more successfully.
Solution 17: "Could Not Find This Item"
A strange situation occurs when File Explorer displays a file but Windows says:
Could not find this item
or:
This is no longer located in...
First press:
F5
to refresh File Explorer.
If the item remains, restart Windows Explorer.
If it still appears, open Command Prompt and inspect the directory:
dir /a "C:\Path"
If you can identify the exact filename, try:
del /f /q "C:\Path\FileName.ext"
For a directory:
rmdir /s /q "C:\Path\FolderName"
File-system corruption should be considered if the directory entry behaves abnormally.
Solution 18: Fix "The Directory Is Not Empty" Error
You may receive:
Error 0x80070091: The directory is not empty
even when the folder appears empty.
First enable hidden items:
File Explorer → View → Show → Hidden items
Check whether hidden files exist.
You can also use:
dir /a "C:\Path\Folder"
If Windows reports inconsistent directory information, run a file-system check as explained later in this article.
Solution 19: Delete the File in Safe Mode
Safe Mode loads Windows with fewer drivers, services, startup programs, and third-party components.
A file locked during normal startup may therefore become deletable.
In Windows 11/10, one route is:
Settings → System → Recovery → Advanced startup → Restart now
Then select:
Troubleshoot → Advanced options → Startup Settings → Restart
After restart, choose:
Safe Mode
or:
Safe Mode with Networking
Try deleting the problematic item.
Restart Windows normally afterward.
Solution 20: Run CHKDSK for File-System Problems
If files or folders behave abnormally, the drive's file system may contain errors.
Open Command Prompt as Administrator.
First, a non-repairing scan can be useful:
chkdsk C: /scan
For supported NTFS volumes, this performs an online scan.
If repair is required, you may use:
chkdsk C: /f
If Windows reports that the volume is in use, it may ask whether the scan should be scheduled for the next restart.
Enter:
Y
Restart the computer.
Important
CHKDSK repairs file-system structures; it is not a general-purpose data-recovery utility.
If the disk is showing hardware-failure symptoms, unusual noises, repeated I/O errors, disappearing partitions, or contains critical data that has not been backed up, prioritize backup/recovery assessment before repeatedly stressing the drive.
Solution 21: Run System File Checker for Windows System Problems
If the deletion issue is associated with broader Windows corruption, run:
sfc /scannow
from an elevated Command Prompt or Terminal.
Wait until verification reaches 100%.
SFC is mainly intended to repair protected Windows system files. It is not designed specifically to unlock ordinary personal files.
Solution 22: Repair the Windows Component Store with DISM
If Windows itself appears damaged, use:
DISM /Online /Cleanup-Image /RestoreHealth
After DISM finishes, run:
sfc /scannow
again.
DISM and SFC are appropriate when the inability to delete files appears to be part of a larger Windows malfunction. They are unnecessary for a simple document locked by an application.
Solution 23: Delete OneDrive Files Carefully
If the problematic item is inside a OneDrive folder, synchronization may be involved.
Check the OneDrive status icon.
Allow pending synchronization to complete.
Close applications using the file.
If necessary, pause OneDrive synchronization temporarily, perform the required file operation, and resume synchronization.
Important
Understand whether the file is synchronized before deleting it.
Deleting a synchronized file can cause that deletion to synchronize to other computers and the cloud account.
Pausing synchronization does not necessarily mean the eventual deletion will remain local after synchronization resumes.
Solution 24: Cannot Delete File from Network Folder
Network files are different from local files.
A file on a:
- NAS
- Windows Server
- Shared PC
- SMB share
may be open by another network user.
Closing the file on your own computer may therefore not release the lock.
The server or NAS administrator may need to identify which user/session has the file open.
Also verify that your network account has Delete permission on the share and underlying file system.
Solution 25: Cannot Delete File from USB or External Drive
Check whether the external storage is:
- Write protected
- Read only
- Corrupted
- Using unsupported permissions
- Experiencing hardware errors
For an SD card or adapter, check for a physical write-protection switch.
For an external disk, run an appropriate file-system check if corruption is suspected.
Do not format the drive merely to delete one file unless you have backed up everything and intentionally want to erase the volume.
Advanced Method: Take Ownership with Command Prompt
For advanced permission problems, administrators can use takeown.
For a file:
takeown /f "C:\Path\FileName.ext"
For a folder and its contents:
takeown /f "C:\Path\FolderName" /r /d y
This changes ownership.
Ownership alone does not automatically mean every required NTFS permission has been granted.
Advanced Method: Grant Permissions with ICACLS
After ownership has been corrected, permissions can be adjusted using icacls.
For example:
icacls "C:\Path\FolderName" /grant "%USERNAME%":F /t
This grants the current user Full Control recursively.
Then the folder may be removed with:
rmdir /s /q "C:\Path\FolderName"
Major Warning
Do not use recursive ownership or Full Control commands casually against:
C:\Windows
C:\Program Files
C:\Program Files (x86)
C:\ProgramData
or other protected Windows locations.
Changing system ACLs can weaken security or damage servicing and updates.
What If Windows Says You Need Permission from SYSTEM?
SYSTEM owns or controls many Windows resources.
Before overriding it, ask:
Why am I trying to delete this file?
If it is an operating-system component, deleting it may damage Windows.
If it is an ordinary leftover data folder whose permissions were inherited from an old installation, taking ownership and assigning appropriate permissions may be justified.
What If Windows Says You Need Permission from TrustedInstaller?
TrustedInstaller protection is normal for many Windows components.
It helps protect:
- Windows system files
- Components
- Updates
- Servicing files
Do not take ownership and delete TrustedInstaller-protected files merely to free disk space.
Use supported Windows cleanup or uninstall methods instead.
What If a File Comes Back After Deleting It?
If a deleted file repeatedly reappears, investigate synchronization or software recreation.
Possible causes include:
- OneDrive synchronization
- Google Drive synchronization
- Dropbox
- Backup restoration
- Application-generated files
- Temporary files
- Login scripts
- Scheduled tasks
- Server synchronization
- Another computer recreating the file
Deleting the file repeatedly will not solve the problem if another process is intentionally recreating it.
Recommended Troubleshooting Order
For most users, use this sequence:
- Verify that the file/folder is safe to delete.
- Close applications that may be using it.
- Disable File Explorer Preview Pane temporarily.
- Restart Windows Explorer.
- Restart the computer.
- Check file/folder permissions.
- Check ownership.
- Try renaming or moving the item.
- Use elevated Command Prompt or PowerShell.
- Identify file locks using Resource Monitor.
- Try Safe Mode.
- Investigate long-path or unusual filename problems.
- Check OneDrive/network synchronization.
- Run CHKDSK if file-system corruption is suspected.
- Use ownership/ACL commands only when genuinely required.
This approach avoids using destructive commands before simpler explanations have been eliminated.
Frequently Asked Questions (FAQ)
1. Why can't I delete a file in Windows 11?
The most common reasons are that another application is using the file, your account lacks permission, another user owns it, synchronization software is using it, the filename/path is problematic, or the file system contains errors.
2. Why does Windows say the file is open in another program?
Another process currently has an open handle to the file. Close the related application or use Resource Monitor to help identify the process.
3. How do I force delete a file using CMD?
Open Command Prompt as Administrator and use:
del /f /q "C:\Path\FileName.ext"
Verify the path carefully because command-line deletion can bypass the Recycle Bin.
4. How do I force delete a folder using CMD?
Use:
rmdir /s /q "C:\Path\FolderName"
This deletes the folder and its contents, so confirm the path before executing it.
5. How do I force delete a file using PowerShell?
Use:
Remove-Item -LiteralPath "C:\Path\FileName.ext" -Force
6. How do I delete a folder using PowerShell?
Use:
Remove-Item -LiteralPath "C:\Path\FolderName" -Recurse -Force
7. Why can't I delete a file even though I am an administrator?
Being a member of Administrators does not automatically bypass every NTFS permission, ownership rule, file lock, SYSTEM restriction, TrustedInstaller protection, or application lock.
8. How can I find which program is using a file?
Open Resource Monitor using:
resmon
Go to CPU → Associated Handles and search for part of the filename.
9. Can restarting Windows fix a file that won't delete?
Yes. Restarting releases many temporary file handles and is one of the safest first troubleshooting steps.
10. Why can I see a file but Windows says it cannot find it?
The File Explorer display may be stale, the filename/path may be unusual, or the file system may contain an inconsistent directory entry. Refresh Explorer, restart Explorer, inspect the directory from Command Prompt, and check the file system if necessary.
11. Can CHKDSK fix an undeletable folder?
Yes, when the underlying cause is file-system corruption. CHKDSK will not normally solve a file that is simply locked by an application.
12. Is it safe to delete files owned by TrustedInstaller?
Not automatically. TrustedInstaller protects important Windows components. Removing protected files can damage Windows or Windows Update.
13. Why can't I delete an empty folder?
The folder may contain hidden/system files, an application may be using it, its permissions may be incorrect, or the file system may incorrectly report its contents.
Check using:
dir /a "C:\Path\Folder"
14. Why does the deleted file keep coming back?
Cloud synchronization, backup software, an application, another computer, a scheduled task, or a server may be recreating it.
15. Can Safe Mode help delete locked files?
Yes. Safe Mode starts fewer applications and services, which may prevent the program responsible for the lock from loading.
16. Should I use third-party "force delete" or "unlocker" software?
Usually not as the first solution. Windows already provides Task Manager, Resource Monitor, Safe Mode, Command Prompt, PowerShell, permissions, ownership tools, and file-system repair utilities.
Only use third-party utilities from trusted sources when built-in methods are insufficient.
17. Does Shift + Delete force-delete a locked file?
No.
Shift + Delete bypasses the Recycle Bin, but it does not bypass active file locks, NTFS permissions, or Windows protection.
18. Will taking ownership always let me delete a file?
No. Ownership allows you to modify permissions, but the file may still be locked by a process or protected for another reason.
19. What is the difference between DEL and RMDIR?
DEL is primarily used to delete files.
Example:
del "C:\Temp\File.txt"
RMDIR or RD removes directories.
Example:
rmdir /s /q "C:\Temp\OldFolder"
20. What should I do if none of these methods works?
Determine whether the problem is caused by:
- File-system corruption
- Disk hardware problems
- NTFS permissions
- SYSTEM/TrustedInstaller protection
- A persistent process lock
- Cloud synchronization
- Network/server locking
- A very long or malformed path
- Malware/security software
- A damaged Windows installation
Do not continue forcing deletion until you understand why Windows is protecting or locking the item, particularly when the affected file is inside a Windows or application directory.
#Tags
#CannotDeleteFile #CannotDeleteFolder #Windows11 #Windows10 #WindowsTroubleshooting #FileAccessDenied #FolderAccessDenied #AccessDenied #FileInUse #FolderInUse #FileOpenInAnotherProgram #ForceDeleteFile #ForceDeleteFolder #DeleteLockedFile #DeleteLockedFolder #WindowsFileError #WindowsFolderError #FilePermission #FolderPermission #NTFSPermissions #TakeOwnership #WindowsPermissions #CommandPrompt #WindowsCMD #PowerShell #RemoveItem #DELCommand #RMDIR #Takeown #ICACLS #WindowsExplorer #FileExplorer #RestartExplorer #ResourceMonitor #SafeMode #CHKDSK #SystemFileChecker #SFC #DISM #FileSystemCorruption #DirectoryNotEmpty #Error0x80070091 #Error0x80070005 #OneDrive #WindowsSecurity #WindowsSupport #WindowsRepair #WindowsTips #WindowsHelp #BisonKnowledgebase
Was this guide useful?
Your answer helps us keep BISONKB accurate and practical.