Access denied on file (and how to remove it)

I had some files on my system which I couldn’t delete. It gave an ‘Access denied on file’ error. I tried a lot of things, including installing several tools. To no avail.

In the end, and I had found some clues on the web, the solution was to obtain ‘ownership’ of the stubborn files. Probably these files had an owner who for whatever reason now didn’t exist anymore on my system. Taking ownership of the file goes as follows:

– Locate the file (or directory)
– Right mouse button, and select Properties
– Select Security tab
– Click Advanced button
– Select Owner tab
– Click Edit
– Select Administrators and click OK (Administrators is now the new owner)
– Click OK on all open windows

After you have obtained ownership and closed all property windows (with OK), start again because now the properties WILL show you the groups and users who hold permissions. And only now you CAN remove those because, well, now YOU are the owner:) Proceed as follows:

– Locate the (same) file (or directory)
– Right mouse button, and select Properties
– Select Security tab
– Click Edit
– Remove all groups and users
– Add user Administrators and give it Full Control
– Click OK on all open windows

You now CAN delete the file:)

Note: You can propagate ownership and permissions into subdirectories and stuff (if you need to remove a complete directory). Experiment with that. But remember, key is taking ownership!

Edit (april 7, 2014): In case you do not have the security tab of the file/folder, try to do the following (for XP) to get the security tab: Open an Explorer window. Click >Tools, >Folder Options…, >View TAB, and scroll to the bottom of the Advanced settings: window, UNCHECK the box for Use simple file sharing [Recommended], click Apply, and you’re golden. Credits to poster Freeman at http://arstechnica.com/civis/viewtopic.php?p=2120356

— Max

This entry was posted in Tech and tagged , . Bookmark the permalink.

One Response to Access denied on file (and how to remove it)

  1. JoshuaReen says:

    I like this way. This trick is good for users who love to play with technical ways. However, I have used “Long Path Tool” software in this situation and it helped me easily and quickly. So this tool is best for those members who don’t love to play with technical skills.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s