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.

  • 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 Apr 20 '17 at 15:51
  • 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 Feb 7 at 11:51

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.
  • 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 Nov 14 '17 at 3:15
  • 1
    @psusi what are you trying to convey? That this error couldn't have possibly been caused by reason #2 in the answer? – djsmiley2k Nov 14 '17 at 13:34
  • 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. – user477799 Nov 14 '17 at 13:42
  • @djsmiley2k, yes, that is what I'm saying. – psusi Nov 15 '17 at 23:49
  • 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. – user477799 Nov 16 '17 at 7:13

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

protected by Community Nov 14 '17 at 14:07

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.