Can't Delete COM Files From Trash? Fix It
In this article
Yes, you can delete COM files stuck in the Trash, but the usual "Empty Trash" button often fails because the file is locked, in use by a program, or the system flags it as protected. The fix is to unlock the file, close any program using it, then force-delete it via the command line or a dedicated deletion tool. Below are the exact steps for Windows and macOS.
What You'll Need
- Administrator or owner account on the computer
- Access to Terminal (macOS) or Command Prompt/PowerShell (Windows)
- Patience — do not skip the troubleshooting steps
Step-by-Step
For Windows (Recycle Bin)
- Close all programs that might be using the COM file. COM files are executable components, often used by system processes or legacy software. Check the Task Manager (Ctrl+Shift+Esc) and end any suspicious processes that might be holding the file.
- Try emptying the Recycle Bin normally. Right-click the Recycle Bin icon on the desktop and select "Empty Recycle Bin." If it works, you're done.
- If that fails, open Command Prompt as Administrator. Click Start, type
cmd, right-click "Command Prompt," and select "Run as administrator." - Navigate to the Recycle Bin folder. Type
cd /d C:\$Recycle.Binand press Enter. (The drive letter may differ if your Recycle Bin is on another drive.) - List the contents. Type
dir /sto see all files, including hidden ones. Look for the COM file you want to delete. - Delete the file using the command line. Type
del /f /q "path\to\file.com"— replace the path with the actual location. The/fforces deletion of read-only files, and/qsuppresses confirmation prompts. - If the file is still locked, use the
rdcommand to remove the entire folder containing it. Typerd /s /q "folder\path"to remove the folder and everything inside it. Be careful — this permanently deletes all files in that folder. - Restart the computer if the above fails, then try again. Sometimes a reboot releases file locks.
For macOS (Trash)
- Close all apps that might be using the COM file. Check Activity Monitor (in Applications > Utilities) for any process with the same name or related to the file.
- Try emptying the Trash normally. Right-click the Trash icon in the Dock and select "Empty Trash." If it works, you're done.
- If that fails, open Terminal. Go to Applications > Utilities > Terminal.
- Navigate to the Trash folder. Type
cd ~/.Trashand press Enter. - List the files. Type
ls -lato see all files, including hidden ones. Identify the COM file. - Force delete the file. Type
rm -f "filename.com"— replace with the actual name. The-fflag forces deletion and ignores permissions. - If the file is locked, first unlock it. Type
chflags nouchg "filename.com"to remove the immutable flag, then try thermcommand again. - If the file is in use, restart your Mac and try again immediately after reboot.
Common Mistakes
- Not closing all programs: A COM file in use by a background process will resist deletion. Always check Task Manager or Activity Monitor first.
- Using the wrong command syntax: Typos in the path or missing flags like
/for-fcan cause the command to fail silently. - Deleting the wrong file: The Recycle Bin/Trash may contain multiple files with similar names. Double-check the exact filename before running the delete command.
- Forgetting to run as administrator: On Windows, the command prompt must be elevated; otherwise, you'll get "Access Denied."
- Assuming a reboot won't help: Many file locks are released after a restart. Skipping this step can lead to unnecessary frustration.
Tips
- Use a dedicated deletion tool like Unlocker (Windows) or Trash It! (macOS) if you prefer a GUI. These tools integrate with the right-click context menu and can force-delete locked files.
- On Windows, you can also try Shift+Delete to permanently delete the file from the Recycle Bin without sending it there again — but only if the file is not locked.
- If the COM file is part of a software installation, consider uninstalling that software first via Control Panel (Windows) or by dragging the app to Trash (macOS). This often removes associated files cleanly.
- Keep your system updated. Sometimes file deletion bugs are fixed in OS updates.
Troubleshooting
If the file still won't delete after following the steps above, try these in order:
- Check for malware. Some COM files are malicious and may be protected by a running virus. Run a full system scan with your antivirus software.
- Boot into Safe Mode. On Windows, restart and press F8 (or Shift+Restart) to boot into Safe Mode. On macOS, restart and hold the Shift key. In Safe Mode, only essential processes run, which may release the lock on the file. Then try deleting it again.
- Use a Linux live USB (advanced). If you're comfortable, boot from a Linux USB drive and delete the file from there. This bypasses the operating system's file locks entirely. This is a last resort.
- Check file permissions. On Windows, right-click the file, go to Properties > Security, and ensure your account has "Full control." On macOS, Get Info > Sharing & Permissions and set your user to "Read & Write."
- If the file is in the system Recycle Bin folder on a different drive, repeat the Windows steps but change the drive letter (e.g.,
D:\$Recycle.Bin).
Frequently Asked Questions
Why can't I delete a COM file from the Recycle Bin?
The file is likely locked by a running process, has read-only attributes, or is protected by the operating system. The steps above force deletion by unlocking and removing the file via the command line.
Is it safe to delete COM files?
COM files are executable components. If the file is in the Trash/Recycle Bin, it was already marked for deletion, so it's safe to remove. However, if the file is still in use by a program, deleting it may cause that program to malfunction until reinstalled.
What if the COM file is not in the Recycle Bin but in a system folder?
Do not delete system COM files unless you're absolutely sure they're not needed. Deleting system files can break your OS. Only delete files that are clearly in the Trash/Recycle Bin.
Can I use third-party software to delete locked files?
Yes, tools like Unlocker (Windows) or Trash It! (macOS) are designed for this. They add a right-click option to force-delete locked files. Always download from official sources.
Will emptying the Trash on macOS permanently delete the COM file?
Yes, once you empty the Trash, the file is gone permanently. There is no built-in way to recover it, so be certain you don't need it.
Why does the file reappear after I delete it?
If the file reappears, it's likely being recreated by a running program or a system process. Close all related programs, scan for malware, and try deleting in Safe Mode.