Fixing “File Cannot Be Deleted” Error – A Detailed Step-by-Step Guide
Sometimes, when attempting to delete a file, you might encounter errors like:
- “Access is denied.”
- “The file is in use by another process.”
- “The file or directory is corrupted and unreadable.”
- “You need permission to perform this action.”
This guide provides detailed steps to identify, troubleshoot, and resolve the issue, ensuring successful file deletion.
Step 1: Identify the Issue
Before trying any fixes, determine why the file cannot be deleted.
Check the Error Message
- “File in use” → The file is open in another program.
- “Access Denied” → You lack permission to delete the file.
- “File is corrupted” → The file system might be damaged.
- “Read-only” → The file is protected.
Step 2: Close Programs Using the File
If the file is in use, closing the associated program can resolve the issue.
Method 1: Close the Application Manually
- Check if the file is open in apps like Word, Excel, or Photoshop.
- Close the application.
- Try deleting the file again.
Method 2: Use Task Manager
If the application won’t close, end it via Task Manager:
- Press Ctrl + Shift + Esc to open Task Manager.
- Find the application using the file (e.g., Word, VLC).
- Right-click → End Task.
- Try deleting the file.
Method 3: Restart the Computer
- Restart your PC to close any background processes.
- After rebooting, try deleting the file.
Step 3: Use Command Prompt to Delete the File
If the file still won’t delete, force delete it using Command Prompt.
Method 1: Delete Using DEL Command
- Open Command Prompt as Administrator (
cmd
→ Run as administrator). - Type the following command:
del /f /q "C:\Path\To\File.txt"
/f
→ Force delete/q
→ Quiet mode (no confirmation)
- Press Enter and check if the file is deleted.
Method 2: Use PowerShell to Delete the File
- Open PowerShell as Administrator.
- Type the command:
Remove-Item -Path "C:\Path\To\File.txt" -Force
- Press Enter.
Step 4: Check File Permissions
If you get an “Access Denied” error, the file may have restricted permissions.
Change File Ownership
- Right-click the file → Properties.
- Go to Security → Click Advanced.
- Under Owner, click Change.
- Type your username and click Check Names → OK.
- Select Replace owner on subcontainers and objects → Apply → OK.
- Try deleting the file again.
Grant Full Control
- Right-click the file → Properties → Security.
- Click Edit → Select your user account.
- Check Full Control → Apply → OK.
Step 5: Delete in Safe Mode
Safe Mode prevents background processes from interfering with file deletion.
Boot into Safe Mode
- Press Windows + R, type msconfig, and press Enter.
- Go to the Boot tab and check Safe boot.
- Click Apply → OK → Restart your PC.
- Try deleting the file.
- After deletion, go back to msconfig and uncheck Safe boot.
Step 6: Use Disk Cleanup
If a file is system-related or corrupted, use Disk Cleanup:
- Press Windows + R, type cleanmgr, and press Enter.
- Select the drive where the file is located.
- Check Temporary Files and Recycle Bin.
- Click OK → Delete Files.
Step 7: Use Third-Party Tools (If Needed)
If the file still won’t delete, use a file deletion tool:
- Unlocker – Unlocks and deletes files.
- IObit Unlocker – Removes locked files.
- FileASSASSIN – Deletes stubborn files.
Step 8: Delete Corrupted Files Using CHKDSK
If the file is corrupted, use CHKDSK to fix it:
- Open Command Prompt as Administrator.
- Type:
chkdsk /f /r C:
- Press Enter and restart your PC.
- Try deleting the file again.
Step 9: Remove File via Linux Live USB (Advanced)
If Windows fails to delete the file, use Linux to bypass restrictions:
- Create a bootable Linux USB using Rufus.
- Boot from the USB and open File Manager.
- Locate the file and delete it.
Step 10: Verify Deletion & Empty Recycle Bin
After deleting the file:
- Open Recycle Bin → Click Empty Recycle Bin.
- Restart your PC to ensure the file is gone.