Can't Delete A Folder In Windows 10

11

3

I'm trying to delete a folder within C:/ProgramData, but each time I try, I get an error message saying:

"You need permission to perform this action. You require permission from administrators to make changes to this folder."

I've tried - unsuccessfully - to take ownership (using the Properties/Security/Advanced etc method), which has always worked for me before.

I also logged into the hidden Administrator account, and get the same message saying "You need permission" etc.

Don't know what else I can try. Does anyone know how to get around this? Thanks.

Update: I found the issue was that the folder had been created by MalwareBytes - running their removal tool solved the issue.

Alex

Posted 2017-03-17T07:19:21.503

Reputation: 151

1@user622800, can you please submit what you discovered as an official answer and accept it accordingly, rather than edit your question to include the solution? Thanks for your help! – Run5k – 2017-04-20T15:51:26.697

I came across this question trying to delete a pesky zip file that would not delete in Windows 10 even after reboot. I was finally able to delete it by booting into Safe Mode. – User – 2019-02-07T11:51:04.137

Answers

14

When you cannot delete a file or folder in Windows, there are usually four problems:

  1. Its NTFS permissions are preventing you. (You are saying you have tried this one, so I won't elaborate.)
  2. It is open in another app. Windows sometimes tells you which. Other times, you must find out for yourself, using third-party utilities like Process Explorer and Process Hacker. In order to find out:

    1. Download, install and run either. Run with administrative privileges.
    2. Press CTRL+F.
    3. Type the name of the file or folder you are looking for and pressEnter.
    4. Look for entries whose "Type" column reads "File". If there are positive matches, either close the process locking the file or folder, or visit the process's entry and close the handle to the file or folder.

      In Process Explorer, clicking on the entry takes you to the handle. You can then right-click and select "Close Handle". In Process Hacker, though, you must right-click and choose "Go to owning process". Then right-click on the process's name, select "Properties" and find the handle there.

    In addition, instead of Process Explorer and Process Hacker, you can boot your system into Repair Mode (a copy of Windows RE) and delete the file there, where the intervening app is not open!

  3. The file or folder name is using illegal characters, making it impossible for the file system to delete it. Try deleting them with Far Manager.

  4. (This one doesn't apply to you, but I include it for completeness.) The disk might be write-protected. No just deliberately by the user; some USB flash drives sometimes malfunction and ... oh, well, long story. Never mind.

user477799

Posted 2017-03-17T07:19:21.503

Reputation:

When you try to delete a directory that is held open by another process, you get a sharing violation. You can still see and change the permissions on the directory, and if you reboot, the directory does not suddenly vanish. This is something different ( and a bug in Windows ). – psusi – 2017-11-14T03:15:33.843

1@psusi what are you trying to convey? That this error couldn't have possibly been caused by reason #2 in the answer? – djsmiley2k TMW – 2017-11-14T13:34:41.687

All four situations can generate this certain error message. Sometimes, they generate a more comprehensive error message, but only sometimes. (To be accurate, this depends on app developers.) Not all four need to happen all at the same time. One is enough. – None – 2017-11-14T13:42:05.030

@djsmiley2k, yes, that is what I'm saying. – psusi – 2017-11-15T23:49:13.263

1@psusi And that's where you are wrong. The OP never even mentioned File Explorer, and only mentioned Windows 10. But Windows 10's error message is: "You'll need to provide administrator permission to delete this folder." The OP's error message resembles a Windows 7 error message, but a couple of words are wrong. So, I didn't tie my reply to any specific OS or file manager. I wrote "When you cannot delete a file or folder in Windows, there are usually four problems" and that's true, broadly construed. – None – 2017-11-16T07:13:22.263

Wow, thank you! In my case, the wmpnetwk service (Win 10 "Media Sharing for Windows Media Player") had choked itself on the folder I was trying to delete - found via Process Explorer "Find handle". – Andre – 2018-06-08T17:05:26.233

There is also a 5th situation: The path name is over 253 to 260 characters long, and the system cannot access the file. This can result from renaming a parent directory with a longer name, pushing the total path length over ~255 characters. Later Win10 builds removed this limit though. – Alex Cannon – 2019-08-07T21:13:38.897

3

What is the exact path of the folder you're trying to delete?

Your unsuccessful attempts to take ownership sounds like it might be a permissions issue, but some folders also have symbolic links or junction points under them that cause odd scenarios that Windows has a hard time dealing with causing it to show you invalid error messages. In these circumstances I usually have better luck with the command line.

Maybe trying one of the following from an administrative command prompt and posting the results (if it doesn't work) would help us diagnose your problem.

rmdir /s /q C:\ProgramData\FolderToDelete

Or create an empty folder somewhere and then use RoboCopy to empty out the folder you want to delete first before deleting it.

robocopy C:\EmptyFolder C:\ProgramData\FolderToDelete /purge

David Woodward

Posted 2017-03-17T07:19:21.503

Reputation: 1 094

0

I was unable to delete some Windows folders from an old installation even when using rmdir /s /q C:\ProgramData\FolderToDelete from an administrator command prompt and received an "Access is denied" error. I was able to delete the folder by:

  1. Changing the owner to my user account (which is an administrator account).
  2. Granting "full control" to the administrator group. Granting "full control" to the administrator group.

  3. Applying the administrator group permissions to all child objects. Applying the administrator group permissions to all child objects.

After those steps re-running the command worked.

Dan

Posted 2017-03-17T07:19:21.503

Reputation: 109