“File cannot be deleted” – Attempt to delete a file that cannot be removed.

Loading

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

  1. Check if the file is open in apps like Word, Excel, or Photoshop.
  2. Close the application.
  3. Try deleting the file again.

Method 2: Use Task Manager

If the application won’t close, end it via Task Manager:

  1. Press Ctrl + Shift + Esc to open Task Manager.
  2. Find the application using the file (e.g., Word, VLC).
  3. Right-click → End Task.
  4. Try deleting the file.

Method 3: Restart the Computer

  1. Restart your PC to close any background processes.
  2. 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

  1. Open Command Prompt as Administrator (cmdRun as administrator).
  2. Type the following command: del /f /q "C:\Path\To\File.txt"
    • /f → Force delete
    • /q → Quiet mode (no confirmation)
  3. Press Enter and check if the file is deleted.

Method 2: Use PowerShell to Delete the File

  1. Open PowerShell as Administrator.
  2. Type the command: Remove-Item -Path "C:\Path\To\File.txt" -Force
  3. Press Enter.

Step 4: Check File Permissions

If you get an “Access Denied” error, the file may have restricted permissions.

Change File Ownership

  1. Right-click the fileProperties.
  2. Go to Security → Click Advanced.
  3. Under Owner, click Change.
  4. Type your username and click Check NamesOK.
  5. Select Replace owner on subcontainers and objectsApplyOK.
  6. Try deleting the file again.

Grant Full Control

  1. Right-click the file → PropertiesSecurity.
  2. Click Edit → Select your user account.
  3. Check Full ControlApplyOK.

Step 5: Delete in Safe Mode

Safe Mode prevents background processes from interfering with file deletion.

Boot into Safe Mode

  1. Press Windows + R, type msconfig, and press Enter.
  2. Go to the Boot tab and check Safe boot.
  3. Click ApplyOK → Restart your PC.
  4. Try deleting the file.
  5. 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:

  1. Press Windows + R, type cleanmgr, and press Enter.
  2. Select the drive where the file is located.
  3. Check Temporary Files and Recycle Bin.
  4. Click OKDelete 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:

  1. Open Command Prompt as Administrator.
  2. Type: chkdsk /f /r C:
  3. Press Enter and restart your PC.
  4. 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:

  1. Create a bootable Linux USB using Rufus.
  2. Boot from the USB and open File Manager.
  3. Locate the file and delete it.

Step 10: Verify Deletion & Empty Recycle Bin

After deleting the file:

  1. Open Recycle Bin → Click Empty Recycle Bin.
  2. Restart your PC to ensure the file is gone.

Leave a Reply

Your email address will not be published. Required fields are marked *