How to Fix “Access Denied” When Deleting a Folder on Windows

Share
A Windows laptop displays a folder on the desktop.

To fix “Access Denied” when deleting a folder, first confirm the folder is not needed by Windows or an installed program, close anything using it, and try again with an administrator account. If permissions are the problem, take ownership of only that confirmed-safe folder and grant your account access; use Command Prompt only when the Properties method fails.

First check whether Windows is protecting the folder for a reason

Symptom:
Access Denied

Windows usually shows this message when another account owns the folder, your account lacks permission, or a program still has a file open. It can also appear when Windows, security software, or an organization’s policy protects the location.

These steps apply to supported Windows 10 and Windows 11 installations. Changing ownership or permissions normally requires Administrator approval. A standard account can sometimes delete the folder after an administrator enters credentials, but it cannot grant itself permission without that approval. Restarting Windows and backing up important files are part of the troubleshooting process.

Before changing permissions, copy any files you may need to another location. Forced deletion can remove personal data, application settings, saved projects, or files that are difficult to recover.

Record the folder’s full path from File Explorer’s address bar. Confirm that the folder is not a protected Windows or program folder. A folder under C:\Windows, C:\Program Files, C:\Program Files (x86), C:\ProgramData, or another system-managed location may be protected because Windows or an installed program depends on it. Do not delete it merely because its name looks unfamiliar.

If the folder came from software you intentionally uninstalled, confirm that the software is no longer installed and that its uninstaller has finished. If it belongs to OneDrive, another backup service, an antivirus product, a development tool, or a work application, use that product’s own removal or cleanup option first.

Do not force-delete a folder inside Windows system directories unless you know exactly what it contains and have a recovery plan. If the folder contains important files, back them up before continuing.

A computer screen shows a Windows system folder among other directories.

Is another app still using the folder?

A folder can report “Access Denied” when a program, File Explorer window, synchronization client, or background service still has a file open. Close the application that created or uses the folder, then close every File Explorer window showing that folder or one of its subfolders.

Pause OneDrive, Dropbox, Google Drive, backup software, or other sync tools. Wait for any pending upload or download to finish before deleting local files. Also close editors, media players, archive tools, terminals, virtual machines, and installer windows that may have a working directory inside the folder.

Restart File Explorer:

  1. Press Ctrl + Shift + Esc to open Task Manager.
  2. Select Windows Explorer.
  3. Select Restart.
  4. Try deleting the folder again.

If the folder is still locked, restart Windows and try before opening the application that may be using it. A restart is also useful when an installer or update left a process running in the background.

For a more specific diagnosis, Microsoft Sysinternals Process Explorer can search for handles containing the folder name. Close the identified application normally where possible. Do not terminate an unknown system process just to remove a folder; use Safe Mode or an administrator account if you cannot identify the lock.

A Windows File Explorer window is open to a folder.

The safest fixes for an Access Denied folder

Try an administrator account first

Sign in with an administrator account, or right-click the program you are using and choose Run as administrator where appropriate. Then try deleting the folder normally. This does not alter the folder’s security settings.

If deletion succeeds, no permission change is needed. If Windows still denies access, continue with the folder attributes and ownership steps.

Remove a read-only or system attribute

Open Command Prompt as administrator. Search for it from the Start menu, right-click Command Prompt, and choose Run as administrator. Replace the example path with the exact folder path.

attrib -R -S -H "C:\Path\To\Folder" /S /D
Command Prompt (run as Administrator)

-R removes read-only, -S removes system, and -H removes hidden attributes. /S applies the change to files and subfolders, while /D includes directories. The command normally returns to the prompt without a success message. Try deleting the folder afterward.

If the command reports that the path cannot be found, check the spelling and quotation marks. If it completes but deletion is still denied, permissions or an open file are the more likely cause.

Take ownership and grant your account permission through Properties

Use File Explorer for a controlled permission change:

  1. Right-click the folder and select Properties.
  2. Open the Security tab and select Advanced.
  3. Beside Owner, select Change.
  4. Enter your Windows account name, select Check Names, then select OK.
  5. Enable Replace owner on subcontainers and objects if that option appears and you intend to remove the entire folder tree.
  6. Select Apply, then close the dialogs.
  7. Open the folder’s Security tab again and select Edit.
  8. Select your account, allow Full control, select Apply, and select OK.
  9. Try deleting the folder.

Windows should accept the ownership and permission changes and allow deletion. If the owner cannot be changed, the account may not have administrator approval, the folder may be in use, or a work or school policy may block the change.

Do not grant Everyone full control or change permissions on the whole drive. Limit the change to the specific folder you have already confirmed is safe to remove.

Use elevated Command Prompt only when Properties is not enough

Open Command Prompt as administrator and run the commands below, replacing the path exactly. takeown assigns ownership to the current administrator, and icacls grants that account full control.

takeown /F "C:\Path\To\Folder" /R /D Y
icacls "C:\Path\To\Folder" /grant "%USERNAME%":F /T /C
Command Prompt (run as Administrator)

/R and /T include items below the folder. /C continues past files that produce errors. Successful output normally shows ownership or permission changes for the path. Once the commands finish, try deleting the folder in File Explorer.

If deletion still fails, do not keep broadening permissions. The folder may be locked, protected by security software, controlled by an organization, or affected by a malformed or overly long path. Use the next section instead.

The Windows folder Properties window displays its security settings.

How to confirm it was deleted without creating a new problem

After deleting the folder, press F5 in the parent directory or close and reopen File Explorer. The folder should no longer appear. If it was sent to the Recycle Bin, open the Recycle Bin and confirm that the expected folder is there before emptying it.

You can also check from an elevated or normal Command Prompt, depending on the location:

dir /a "C:\Path\To\Parent"
Command Prompt

The expected output is a directory listing that does not contain the deleted folder. If Command Prompt says the path cannot be found, that also confirms the target path is gone, provided you checked the exact spelling.

Do not empty the Recycle Bin immediately if the folder might contain needed files. Open it, inspect the contents, and restore the folder if you removed the wrong item. Then launch the application or Windows feature that previously used the folder. If it reports missing files, restore the folder or reinstall the related application rather than downloading random replacement files.

When normal permission fixes fail

If the folder remains after you close applications, restart Windows, and correct permissions, stop using increasingly broad deletion commands. The following cases need a targeted approach.

Try Safe Mode for a persistent lock

Safe Mode starts Windows with a limited set of drivers and startup programs. It can release a lock held by a third-party service. Open the following path:

Settings > System > Recovery > Advanced startup > Restart now
Settings path

Then choose Troubleshoot > Advanced options > Startup Settings > Restart and select Safe Mode. Try deleting the confirmed-safe folder there, then restart normally.

Handle long or unusual paths carefully

Names ending in a space or period, unusual characters, or a path that exceeds Explorer’s normal handling can cause misleading errors. From an elevated Command Prompt, use the extended path prefix and quote the complete path:

rmdir /S /Q "\\?\C:\Path\To\Folder"
Command Prompt (run as Administrator)

This permanently deletes the folder tree instead of using the Recycle Bin. Use it only after checking the path character by character and backing up needed files. If it fails, shorten the parent path by moving or renaming an upper-level folder, or use a trusted file-management tool rather than repeating the command.

Check security software and device policies

Antivirus or endpoint-security software may block changes to monitored folders. Run a scan and review its quarantine or protection history; do not disable protection merely to force deletion. On a work or school computer, administrator policies can prevent ownership changes. The device administrator or IT team must handle that restriction.

If the folder reappears, contains randomly named executables, or is tied to suspicious activity, run a full Windows Security scan and, if needed, Microsoft Defender Offline scan. Malware can recreate files or deliberately interfere with deletion.

Never use blanket commands that reset permissions on C:\, the entire Windows directory, or an entire user profile. They can damage Windows, break applications, and expose private files.

Conclusion

Use the folder’s exact path, back up anything important, and confirm that it is safe to remove. Close programs and sync tools, restart File Explorer or Windows, then try an administrator account and targeted ownership changes. If the folder is locked, malformed, policy-controlled, or suspicious, use Safe Mode, involve the device administrator, or scan for malware instead of widening permissions.

Frequently Asked Questions

Why does Windows say Access Denied when I am an administrator?

Administrator status does not automatically make your account the owner of every folder. Windows may be protecting the folder, another process may have it open, or a security policy may block the action. Take ownership only of the confirmed-safe folder and grant your account permission there.

Will taking ownership delete the folder?

No. Taking ownership changes who controls the folder. You still delete it separately, and you should back up important files before changing permissions.

Can I delete an Access Denied folder from Command Prompt?

Yes, but use an elevated Command Prompt and verify the path carefully. `takeown` and `icacls` can correct ownership and permissions. `rmdir /S /Q` removes the folder permanently without sending it to the Recycle Bin, so reserve it for a confirmed target.

Read more