0

I have this "main.cpp" file created in CodeBlocks, and I got rid of everything in the project folder, "NewDirections" except for this. I ran a del command through the command prompt as an administrator, shown in the following image, which did not work (it got an “Access is denied” error).

del command fails (Access is denied) in administrator command prompt

When I look at the file security under the properties header, I see this:

You must have Read permission to see the properties of this object

It is unable to display the owner.

I tried another route to delete this pesky file by deleting the folder that contains it, but I get this error:

Folder Access Denied
You require permission from ASUS-K501UX\vamad_n1mu3mk to make changes to this folder

(vamad_n1mu3mk is my username).

According to the permissions, I have full access:

VIRAJ MADDUR has “Full control” access to the “NewDirections” folder

6
  • Did you mean, "Nonexistent?"
    – jpaugh
    Commented Aug 1, 2017 at 19:43
  • Yes I did, @G-Man fixed it.
    – vamaddur
    Commented Aug 2, 2017 at 5:38
  • In the interests of full disclosure, (1) YouKnowMe initially wrote “Nonexistant”; another editor changed it to “Nnnexistant”; and I changed it back.  (2) Nobody except jpaugh noticed that it should be “Nonexiste nt” (with an “e ” in the last syllable). Commented Aug 2, 2017 at 6:47
  • (1) At the risk of asking a dumb question: are you sure ASUS-K501UX\vamad_n1mu3mk and “VIRAJ MADDUR ([email protected])” are the same account?  (Can you explain why it is displayed two different ways?)  (2) It might help us to understand this better if you describe exactly what happens when you click “Advanced” on the “Security” tab in the file “Properties” window.  (3) It might be useful to go back to the Administrator (elevated) Command Prompt, and do cd C:\Users\vamad_n1mu3mk\Desktop, dir/q and dir/q NewDirections (/q shows who owns things). … (Cont’d) Commented Aug 2, 2017 at 7:24
  • (Cont’d) …  Feel free to leave out irrelevant information (e.g., the other things in your Desktop folder). (4) You might want to double-check that you’re really administrator by creating a file (copy nul foo is a good way to create an empty file) and checking that it is owned by Administrator (or Administrators) with dir/q and File Explorer.  (5) If you’re using some sort of domain administrator, you might want to look into using a local administrator account. Commented Aug 2, 2017 at 7:25

1 Answer 1

0

If the issue is ownership, right-click on the file in Explorer, select Properties. On the Security tab, select Advanced and change ownership to you, if needed. Then you can change permissions to full control.

However, there may be a process locking the file, e.g. as at https://stackoverflow.com/questions/958123/powershell-script-to-check-an-application-thats-locking-a-file.

There are third-party tools such as LockHunter to help delete such files, too.

4
  • I am not able to change ownership on "main.cpp", but I will look into the other 2 options...
    – vamaddur
    Commented Aug 1, 2017 at 17:35
  • Trying to find the processes, if there are any, locking the file just gives the message "permission denied" when running the cmd prompt as an admin.
    – vamaddur
    Commented Aug 1, 2017 at 17:37
  • @YouKnowMe You need to be an administrator to change ownership.
    – testeaxeax
    Commented Aug 1, 2017 at 19:21
  • I am an administrator for sure, I double checked this just now as well. However, there is a separate "local administrator account" which is empty since I never use it. The file does not show up when I login, since it is attached to my user.
    – vamaddur
    Commented Aug 2, 2017 at 5:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .