Not able to delete file without permission from Nonexistant user/directory
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.
vamaddur
Updated on September 18, 2022Comments
-
vamaddur over 1 year
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).When I look at the file security under the properties header, I see this:
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:
-
Admin over 6 yearsDid you mean, "Nonexistent?"
-
Admin over 6 yearsYes I did, @G-Man fixed it.
-
Admin over 6 yearsIn 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).
-
Admin over 6 years(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
anddir/q NewDirections
(/q
shows who owns things). … (Cont’d) -
Admin over 6 years(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) withdir/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. -
Admin over 6 yearsI ended up using Lock Hunter after researching it to make sure it's trustworthy and it worked.
-
-
vamaddur over 6 yearsI am not able to change ownership on "main.cpp", but I will look into the other 2 options...
-
vamaddur over 6 yearsTrying 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.
-
testeaxeax over 6 years@YouKnowMe You need to be an administrator to change ownership.
-
vamaddur over 6 yearsI 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.