Link to home
Start Free TrialLog in
Avatar of Patrick Miller
Patrick MillerFlag for United States of America

asked on

Unable to delete a file even after I took ownership of the folder it is in.

Logged onto a windows 2012 server as the domain admin.     I was trying to delete a file but I was not able to do so.   I do not have permissions that allow me to do so.   I took ownership of the folder it is in but that did not help.   I believe this file is corrupt but I cannot get rid of it.   Does anyone have any suggestions on how to get rid of the file so I can finish copying the folder from this server to a new server.
Avatar of John
John
Flag of Canada image

Get Unlocker 1.9.2  (http://www.majorgeeks.com/files/details/unlocker.html)

Install it, then right click on the file, select Unlocker, Action: Delete and then OK.  See if that deletes the file.

In stubborn cases, run Unlocker again, Delete again and it will say:  Delete at the next restart.  Now you need to find a convenient time to restart the Server.
Avatar of Pete Long
>> I took ownership of the folder it is in but that did not help

What if you take ownership of the file?
Avatar of Patrick Miller

ASKER

It will not let me take ownership of the file.   It says that I need read-only to get to that option.
ASKER CERTIFIED SOLUTION
Avatar of John
John
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What is the file?  Where is it?  Why are you trying to delete it?  Is this a system file?  Is it in use?
No it is not in use.    It is a corrupt file and it will not allow me to remove it.
Try suggestions as above
If you use unlocker PLEASE don't click next on everything, or you will get some horrible 'Delta toolbar' software thats bobbins!

P
Do you have to run unlocker from the server?    I have tried running it from a workstation, as an domain admin, and it is still there.
Unlocker must be installed on the system you're using it on.
You should really should get it from the source rather than from a download aggregator that directs advertising dollars away from the creator of the software.
http://www.emptyloop.com/unlocker/

Downloading from the author's site supports the author of the software more directly.  I would only ever use the download aggregator if the original site goes away.  Even then, I'd look on archive.org first.
Unlocker must be installed on the system you're using it on.

Yes. That is the way I use it and it works well.
I tried unlocker and it said I need to reboot.   I will have to do that tonight.   Will let you know.
Once rebooted the file should be gone. I have had to do this before.
run this, then try delete again
attrib -r -a -s -h "C:\ThePath\TheFile.xxx"

Open in new window

I tried the attrib command and it failed with Access denied.
 Rebooting is next.
Did you do it from an elevated command prompt?
Yes
If you open up command prompt as admin you can use RD command to try and delete it.

Example,
rd /s /q c:\"directory of the folder"
Have you also added your user to the permissions list after you took ownership?  Even if you own it, you may not have permissions to read, write, delete it until you've been added to the permission list or to a group on the permission list.
it could be the directory structure is also corrupted.. run chkdsk /f on the volume
You may want to remove the file by using the raw name of the file. Sometimes ntfs-named files get corrupted in that file structure.
Try deleting the file on the fat level
cmd as admin
Navigate to the directory the file is in.
dir /x  [to show short names of files]

Identify the short name of the corrupt file. It is sometimes seen like this:
Filena~1
If the filename is 8 or more letters. Once identified..

del Filena~1  [enter]

See if it deletes.

If not..
attrib *.* -h   [enter]
del Filena~1  [enter]
I've written up a quick process for you to see what I mean regarding using 'DIR /X' and the short file name (as explained in my comment above).
Please review the example shown and know the file name and path in the error shown does not match the example process file name. I have already fixed my issues and am using a screeshot from historical records to show what a possible error for this issue looks like. I've used this method as recently as last month so it holds true for all windows versions up to last month.
User generated image
Unlocker worked after rebooting.
Thank you for the update and I was happy to help.