Not able to delete file without permission from Nonexistant user/directory

file-permissionspermissionswindows 10

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

Best Answer

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.

Related Question