How do I force delete a file that won’t delete?

Trying to delete a file that refuses to be removed can be incredibly frustrating. You may have tried sending the stubborn file to your Recycle Bin or Trash, but it keeps coming back with an error saying something like “File in use” or “Access denied.” Don’t worry – there are a few different methods you can try to force delete those pesky undeletable files in Windows and Mac OS.

Quick Overview: How to Force Delete a File

Here’s a quick rundown of the top solutions for forcibly deleting a file that won’t delete:

  • Restart your computer and try deleting the file again
  • Close any programs that may be using the file
  • Use Task Manager (Windows) or Force Quit (Mac) to close background processes/apps locking the file
  • Unlock the file if it’s locked by something like Microsoft Outlook or Adobe software
  • Disable or pause your antivirus software temporarily
  • Delete the file in Safe Mode
  • Use the Command Prompt (Windows) or Terminal (Mac)
  • Delete the file with a third party unlocker tool

The sections below will explore these options in more detail, split up by operating system (Windows vs Mac).

Force Deleting Files in Windows

On Windows PCs, sometimes a file becomes stubbornly undeletable due to something like antivirus software, system permissions, or applications having the file open in the background. Thankfully, Windows provides a few ways to force delete those bothersome files.

Restart Your PC

One quick fix you can try is restarting your computer. After a restart, any applications or services that were using the file in the background will release it, potentially allowing you to delete it.

To restart a Windows 10/11 computer:

  1. Click the Start button in the taskbar in the bottom left corner
  2. Click the Power button near the top right and select Restart

Once your PC boots back up, try deleting the file again.

Close Programs Using the File

Sometimes a file can’t be deleted because it’s currently opened by a program. For example, you may be unable to delete a PDF if it’s currently open in Adobe Acrobat Reader.

Check if any programs have the file open. Close those programs entirely, then attempt deleting the file again.

End Background Processes with Task Manager

Programs running in the background can also lock files in use. To force quit background processes:

  1. Press Ctrl + Shift + Esc to open Task Manager
  2. Go to the “Processes” tab
  3. Select any process that might be using the file, like Adobe Acrobat, Microsoft Office apps, etc.
  4. Click “End task” to close that process

With the background process closed, check if you can now delete the stubborn file.

Unlock Files Locked by Applications

Some programs will intentionally lock files to prevent deletion or editing. For example, Microsoft Outlook may lock PST data files, while Adobe apps lock files open for editing.

For Microsoft Office files like Word documents or Excel spreadsheets that won’t delete, try:

  • Opening the file in the associated Office app like Word or Excel
  • Going to File > Info > Protect Document > Mark as Final
  • Saving the changes then closing the file

This unlocks any restrictions on deleting the file.

For Adobe files like PDF documents that are locked, first close the file in Adobe Acrobat Reader. Then go to File > Properties and uncheck any “Locked” boxes under Security. You can now delete the PDF.

Temporarily Disable Antivirus

Sometimes your antivirus software can lock files to prevent deletion. You may see an “Access denied” error when trying to delete these files.

Try temporarily disabling your antivirus protection, then attempt deleting the file again. Just be sure to re-enable your antivirus once done.

Delete in Safe Mode

Booting into Windows Safe Mode loads a minimal version of the operating system. This can prevent any third-party software from locking files.

To delete a file in Safe Mode:

  1. Open the Start menu and select the Power button > Hold Shift while clicking Restart
  2. On the recovery screen, select Troubleshoot > Advanced options > Startup Settings > Restart
  3. After your PC restarts, select Safe Mode from the startup settings menu
  4. Log into your account and try deleting the file again

Use the Command Prompt

The Command Prompt gives you access to some more advanced file deletion options. Two useful options are:

  • DEL /F – Force deletes a file by overriding any permissions
  • DEL /S – Deletes a file in specified folders and subfolders

For example, to force delete a file named “file.txt” on your desktop:

  1. Open the Command Prompt as admin
  2. Type DEL /F /S C:\Users\YourName\Desktop\file.txt and hit Enter

This will forcibly delete “file.txt” even if permission was denied.

Use Third Party Unlocker Tools

If the above options don’t work, another option is to use third party unlocker software specifically designed to delete stubborn files. Some popular choices include:

  • IObit Unlocker – Freeware that force deletes files being used by other programs
  • Unlocker – Freeware by EmptyLoop that deletes locked files
  • LockHunter – Freeware “unlocker” tool from Crystal Rich Ltd

These tools make it easy to quickly delete any locked files, by presenting a right-click “Unlocker” option in File Explorer.

Force Deleting Files on Mac

Macs also have a few ways to forcibly delete stubborn files and bypass “File in use” errors.

Restart Your Mac

Like with Windows, a simple restart of your Mac can release any locks on a file by background programs. After restarting, check if you can now delete the file successfully.

To restart a Mac:

  1. Click the Apple menu and select Restart
  2. Or press Control + Command + Power button

Force Quit Apps Using the File

Apps accessing the file can prevent file deletion on Mac. Close any apps using the file fully, then try to delete it again.

You can also use Force Quit to close unresponsive apps by:

  1. Pressing Option + Command + Esc
  2. Selecting the app
  3. Clicking Force Quit

Unlock Locked Files

On Macs, some files may be locked by apps like Time Machine or Outlook for Mac. To unlock them:

  • Open the file in Finder and press Command + I to Get Info
  • Uncheck the “Locked” box

Now try deleting the file again.

Disable Antivirus Temporarily

Just like on Windows, antivirus programs on Mac can also block deletion of certain files. Try temporarily disabling your antivirus, then attempt to delete the file.

To disable antivirus protection in Mac OS:

  1. Click the Apple menu and go to System Preferences > Security & Privacy
  2. Select the option to turn off antivirus protection

Once done deleting the file, remember to re-enable your antivirus.

Delete in Safe Mode

On Macs, Safe Mode also loads a minimal version of the OS to prevent interference from other software.

To delete a file in Safe Mode on Mac:

  1. Restart your Mac and hold down the Shift key
  2. Let go of Shift once you see the login screen
  3. Log in and attempt deleting the file
  4. Restart again to exit Safe Mode

Use Terminal

Mac’s Terminal gives you some advanced file deletion commands, like:

  • rm -f – Force delete a file by overriding permissions or files open by other programs
  • xargs rm -rf – Delete a directory and all its contents recursively

For example, to force delete a file named “document.pages”:

  1. Open Terminal
  2. Type rm -f /Users/yourname/Documents/document.pages and press Enter

This will instantly delete the file despite any locks or permissions set on it.

Use Unlocker Tools

Third party unlockers like IObit Unlocker and LockHunter also work on Mac to easily force delete any locked files.

They add an “Unlock” option when right-clicking on locked files in Finder, making them quick and easy to delete.

Why Files Can Become Undeletable

Before using the above solutions, it helps to understand some common reasons why a file may become seemingly impossible to delete on both Windows and Mac machines:

  • File permissions – The file permissions may prevent you from deleting it, like if a file is marked read-only.
  • Other programs accessing it – If a file is open in another program, it may be locked and undeletable.
  • Background processes – Programs running in the background can lock files in use without you realizing.
  • Antivirus software – Security software may intentionally lock files to keep them safe.
  • File corruption – If a file is corrupted, the operating system may have trouble deleting it.
  • OS glitches – Sometimes system glitches can cause “ghost files” that seem impossible to delete.

Luckily the methods above give you a variety of ways to force delete problem files regardless of what’s locking them.

How to Avoid Undeletable Files

While undeletable files can certainly be frustrating, there are some ways to try avoiding them altogether:

  • Close files/apps properly after use so they don’t lock files
  • Manage permissions carefully when locking down files
  • Prevent antivirus from locking down non-suspicious files
  • Use unlocker tools proactively to monitor locked files
  • Clean up old unused files regularly
  • Check for file corruption and OS issues

Practicing good file management habits goes a long way towards preventing any stubborn undeletables!

Conclusion

Dealing with files that refuse deletion can be extremely annoying. But thankfully Windows, Mac, and third party tools provide several effective ways to force delete those stubborn undeletable files.

Some top solutions include:

  • Restarting your computer
  • Closing background processes
  • Using Safe Mode
  • Running Command Prompt/Terminal commands
  • Disabling antivirus temporarily
  • Using unlocker tools

So don’t let seemingly undeletable files get you down. With the help of the handy tips in this guide, you can swiftly force delete those pesky locked files and finally get them out of your hair once and for all.