GuideHQ

Why can I not delete this file — it says it is open in another program?

Something has the file open, or the file is marked read-only, or the permissions are wrong. Three different causes with three different fixes, and one that is almost always the answer.

Difficulty
beginner
Time
20 min
Read
4 min
Safety
caution

Short answer

Nine times out of ten something has it open, and the usual suspects are a file browser preview pane, a media player, an office application that did not quit properly, a search indexer, antivirus, or a cloud sync client mid-upload. Close them, or restart the machine, and it will delete. If it still refuses, check whether it is marked read-only, and then whether you have permission — a file copied from another machine or another user account often carries the old ownership.

Safety

Tools that force the deletion of locked files work by breaking the lock a program is relying on, which can corrupt the file, the program's data or, in system locations, the system itself. Try the ordinary routes first, and never force-delete something in a system folder to make an error message go away.

Step by step

  1. Close the obvious things first.Any window showing the file or its folder, media players, office applications, and the preview pane in the file browser, which counts as having the file open. Turning off the preview pane fixes a surprising share of these outright.
  2. Restart the machine.Unglamorous and it resolves the large majority. Locks do not survive a restart, so if the file deletes afterwards, the cause was a program that had not released it. On Windows, choose restart rather than shut down.
  3. Find out what is holding it, if it persists.Windows' resource monitor has a search facility for associated handles that names the process holding a file, and macOS has a command-line equivalent. This turns guesswork into a name, and the name is often antivirus, an indexer, or a sync client.
  4. Check the read-only attribute.A read-only file can be deleted with confirmation but not modified or saved over. Files copied from a CD, from an email attachment opened in place, or from certain shares arrive marked read-only. Clear it in the file's properties, or for a whole folder at once.
  5. Check the file is not simply open elsewhere on a network.On a shared drive or a NAS, another computer in the house may have it open. Nothing on your machine will show that; check the other machines, or the share's own list of open files.
  6. Then look at permissions.Files carrying ownership from a different user account or a different machine produce access-denied rather than in-use messages. Take ownership of the file or folder, which Windows offers in the security settings, or ignore ownership on the volume on a Mac.
  7. Try safe mode for stubborn cases.If a background program has the file open every time the machine starts, safe mode starts without it and the file deletes normally. This is the correct answer for files held by security software or an uninstalled program's leftovers.
  8. Treat unlocker tools as a last resort.They work, and they work by force. Use one only on a file you understand, in your own documents, after the other routes have failed, and never in a system folder.

If it doesn't work

The file is in use by a program I cannot see

Cause: A background process — indexer, antivirus, sync client — or a program that did not close properly — Fix: Restart. If it recurs for the same file, identify the process holding it and exclude that folder from the program's scanning or indexing.

Cannot save over a file, only save as a copy

Cause: Read-only attribute, or the original is open elsewhere — Fix: Clear the read-only attribute in the file's properties, and close any other window with it open. On a shared drive, someone else may have it open for editing.

Access denied even as an administrator

Cause: Ownership belongs to another account or a system component — Fix: Take ownership of the file or folder. Be cautious in system locations, where the restriction is deliberate.

Folder will not delete because it is not empty, but appears empty

Cause: Hidden or system files inside, or a name the system cannot handle — Fix: Show hidden items. If the folder contains a file with a name the file browser cannot process, deleting the parent folder from the command line usually works.

Path is too long to delete or copy

Cause: A deeply nested structure exceeding the traditional path limit — Fix: Rename the parent folders to something short, which shortens the whole path, then delete. Compressing the folder into an archive first and deleting the archive also works.

File deletes and reappears

Cause: A cloud sync client restoring it from the service — Fix: Delete it in the service as well, or pause sync, delete locally, and let it reconcile. A file that keeps returning is being restored by something, not resurrecting itself.

Questions people ask

Why does the preview pane count as having the file open?

Because it genuinely opens the file to render the preview, and holds it while the folder is displayed. It is the single most common invisible cause of this message.

Is it safe to force-delete?

On your own document, generally yes. On anything belonging to a program or the system, no — the lock exists because something is relying on the file being there.

Why can I delete it but not open it?

Deleting needs permission on the folder; opening needs permission on the file. They are separate, which is why the two can disagree.

Written and maintained by the GuideHQ editorial team. More in Technology.