We’ve all been there before – you have a file on your computer that you want to delete, but for some reason it just won’t budge. No matter how many times you try to send it to the Recycle Bin, the file remains firmly in place, almost mocking your futile attempts to get rid of it.
There are a number of reasons why a file may refuse deletion. It could be in use by a running program, marked as read-only, corrupted in some way, or stubbornly sticking around due to permissions issues. Whatever the cause, being unable to delete a file can be extremely frustrating.
Fortunately, with the right approach and tools, even the most stubborn of files can eventually be banished from your hard drive for good. Here are some effective methods for getting rid of those pesky undeletable files.
Check and Close Associated Programs
One of the most common reasons a file can’t be deleted is because it is currently open or in use by a program on your computer. If a file is locked by an application, Windows will not allow it to be deleted.
Before attempting to delete stubborn files, you should close all programs that could potentially be using them. This includes any apps that may run automatically in the background. Exit your email, office suites, media players, browsers, and any specialty software related to the file type in question.
Once all associated programs have been closed, try deleting the file again and see if it works. Simply closing open applications will allow many seemingly undeletable files to be removed successfully.
Unlock the File
If closing background programs doesn’t do the trick, the file you want to delete may be locked by the operating system itself. On Windows computers, right clicking a file and selecting properties will display information about it. If there is a checkmark by “Read-only” under the General tab, it means the file attributes are configured as read-only.
Read-only status prevents files from being altered or deleted. To unlock a read-only file:
- Right click on the file and select Properties
- Uncheck the box next to Read-only
- Click Apply then OK
With read-only unchecked, you should now be able to delete the file as usual.
Change File Permissions
If a file seems undeletable even when unlocked, the next thing to check is your user account permissions. On business networks or computers with multiple user profiles, access to files and folders is typically restricted based on user privileges.
To delete a file your user profile does not have full control permissions for:
- Right click the file and select Properties
- Go to the Security tab and click Advanced
- Change the owner to your user account
- Ensure your user account has Full Control checked
- Apply the permission changes
Taking ownership and granting yourself Full Control enables you to bypass permission restrictions so you can delete the file.
Boot Into Safe Mode
Booting into Windows Safe Mode loads a minimal, pared back version of the operating system. This can allow you to delete files you couldn’t remove when fully booted into Windows.
To boot into Safe Mode:
- Open the Start menu and click the Power button
- Hold down the Shift key while clicking Restart
- On the Choose an Option screen select Troubleshoot > Advanced Options > Startup Settings > Restart
- After your PC restarts, press 5 on the Startup Settings screen to boot into Safe Mode
Now try deleting the file. Some files that persist due to program locks or SYSTEM permissions may be removable from Safe Mode.
Delete on Boot
Another option is to schedule the stubborn file for deletion the next time you restart your computer. This works because pending file operations are executed as Windows loads before other programs start.
To set a file to delete on reboot:
- Press Windows + R to open the Run box
- Type: cmd
- Click OK to open Command Prompt
- Type: del /f /q “C:\Path\To\File” /s /r
- Replace the file path with your target file
- Restart your computer
The /f /q /s /r parameters force deletion of the specified file on restart. This method can remove files that resist other deletion attempts.
Use Unlocker
For advanced cases where built-in methods fail, try using a specialized unlocking utility. Unlocker is a free tool designed specifically for deleting stubborn files.
To use Unlocker:
- Install and open Unlocker
- Right click on the locked file and select Unlocker from the context menu
- Click Unlock or Delete
Unlocker will attempt to free the file from any locks or handles that are preventing deletion. It provides a force delete option that usually succeeds in removing the most stubborn of files.
Delete from Command Prompt
Command Prompt provides access to powerful built-in tools that can forcibly delete stubborn files when other methods fail.
To delete an undeletable file from Command Prompt:
- Open Command Prompt as administrator
- Type takeown /f “C:\Path\to\File” and hit Enter
- Type icacls “C:\Path\to\File” /grant Administrators:F and hit Enter
- Type del /f /a “C:\Path\to\File” and hit Enter
The takeown command takes ownership of the file. Icacls grants Full Control permissions to your Admin account. Del /f /a forcibly deletes the file.
Delete System File from PE Environment
If the undeletable file is a Windows system file that loads at boot, you may need to delete it from a Preinstallation Environment (PE). This gives full access before the operating system starts.
To delete stubborn system files using a PE:
- Create a Windows 10 bootable USB or DVD using Media Creation Tool
- Boot your PC from the installation media
- Select Repair your Computer at the first screen
- Go to Troubleshoot > Command Prompt
- At the X:\Sources> prompt type: diskpart
- Type list volume and note your Windows drive letter
- Type exit to close DiskPart
- Type del D:\Path\to\File using your Windows drive letter
- Close Command Prompt and restart normally
From the PE environment, locked system files can be deleted before Windows boots up.
Reset Security Settings
Corrupted security settings can also cause files to become undeletable. Resetting your user or system security policies may help eliminate file lock issues.
To reset security policies:
- Open Command Prompt as admin
- Run netplwiz and uncheck require users to enter a username and password
- Sign out or restart your PC and sign back in
- Run sfc /scannow to scan and restore system files
- Run DISM /Online /Cleanup-Image /ScanHealth to scan and repair the Windows image
Resetting user and system security settings can help resolve corrupted permissions preventing file deletion.
Delete from Linux Live CD
Booting from a Linux live CD provides a simple way to delete Windows files from an external operating system. Since the Windows filesystem drivers are not loaded, file locks and permissions are ignored.
To use a Linux Live CD to delete Windows files:
- Download an Ubuntu ISO and create a bootable DVD or USB
- Boot your PC from the Ubuntu media
- Open the File Manager and navigate to your Windows drive
- Right click on files and click Delete to remove them
- Restart your PC and boot back into Windows
Deleting files through an external Linux environment is an effective way to bypass Windows file lock restrictions.
Repair Drive Errors
If a system file becomes damaged, it can remain locked and prevent deletion. Repairing drive errors may restore proper file operations.
To fix drive errors that could cause file lockouts:
- Open Command Prompt as admin
- Run chkdsk C: /f to scan your primary drive
- Use the parameter /r instead of /f if bad sectors are reported to fully repair errors
- Restart your PC and retry deleting the file
Chkdsk scans and restores filesystem errors that can sometimes cause stubborn file issues.
Delete from Elevated RE Command Prompt
The Windows Recovery Environment (RE) provides access to advanced Windows troubleshooting tools. An Admin Command Prompt within RE has full system privileges for deleting locked files.
To access the RE Admin Command Prompt:
- Open the Start menu and search for “Recovery”
- Click Recovery -> Reboot Now under Advanced Startup
- After your system reboots select Troubleshoot > Advanced Options
- Go to Command Prompt and run commands to delete your file
The RE environment provides powerful file deletion capabilities that can overcome stubborn locks.
Disable Antivirus Temporarily
Some antivirus programs will quarantine or lock infected files to prevent spreading malware. You may need to temporarily disable your antivirus to remove quarantined files.
To disable antivirus protection:
- Open your antivirus software settings
- Find the option to disable virus and threat protection
- Save your changes and restart your computer
- Try to delete quarantined files before re-enabling protection
Turning off antivirus shields allows removal of infected files in quarantine.
Conclusion
While undeletable files can certainly be a headache, there are many effective methods available for regaining control of your hard drive. With the right tools and techniques, even the most stubborn files that defy deletion can eventually be banished.
The key is to remain calm and methodical in your approach. Carefully work through each solution until you find the one that works for your specific situation. Trying simpler options first, like closing programs or unlocking files, can resolve many issues before moving onto more complex solutions.
Leveraging the power of Command Prompt, recovery environments, and external OS deletion provides the ultimate file removal capabilities when needed. Don’t let difficult files win – persist and keep trying different tactics until you can successfully delete anything.