23

I have got this file that I can't delete. It happened after a system crash, so the CHKDSK kicked in upon next reboot. After that, I can't delete the file. THis is on Windows Home Server, and the file is one of those hidden Thumbs.db, and my WHS reports a "File conflict" on the file, the reason: Access Denied"

What I have tried so far, running as an Administrator:
Delete: Access Denied
TakeOwn.exe : Access Denied
Attrib.exe -s -h : Access Denied
cacls.exe : Access Denied (even whe trying to display the current owner)
Rename: File not found (its hidden)
Re-boot in to safe mode and tried the above: Access Denied
Running the above commands as Local System: Access Denied

Tizer Unlocker: Fail (Doesn't find anything locking the file)
File Assasin: Crashes ("FindRemoteFileHandles returned NULL value.")

I have used the CHKDSK /f again, rebooted since some suggestions is that the file has been corrupted, but that didn't change anything.
Any suggestions ?

Update: In a total separate scenario, I experienced a similar situation; Access Denied when trying to take ownership of a file. It turned out that the file was owned by TrustedInstaler, which is not possible to override just by being an Administrator. In this case, one can use psexec /ids cmd to elevate yourself to System and then TakeOwn.exe /a

  • 1. Who is the current owner of the file? 2. Are you sure you have the "take ownership" privilege? 3. Are you able to rename/move the file? (it might sound unlikely but try it!) – Hugh Allen Apr 12 '10 at 7:18
  • @Hugh. 1. Can't be determined. CACLS.EXE gets Access Denied when trying to display owner. 2. I can't get any higher in the hierarchy than Administrator. 3. Rename can't find the file, since its hidden. – Magnus Apr 12 '10 at 19:14
  • Have you tried using Process Monitor to see what the low-level error is? technet.microsoft.com/en-us/sysinternals/bb896645.aspx – Hugh Allen Apr 14 '10 at 7:12
  • (in Process Monitor, so as not to be overwhelmed with a flood of info, add an Include filter for "Path contains Thumbs.db". An Include filter excludes everything else.) – Hugh Allen Apr 14 '10 at 7:15
  • 1
    and when psexec then takeown ALSO results in an "access denied" ? How do I use process monitor to find this low level error? – frumbert Jul 2 '15 at 6:26
19

I had the same problem earlier today and fixed it using Unlocker. I don't know if it's any different from the tool that Nicu Zecheru recommmended, but I thought I'd share it here for future reference.

At first didn't believe that the folder could actually be locked, I restarted my PC several times since I first discovered that I am unable to access it, and none of these things worked:

  • chkdsk /f - scanned the disk but found nothing
  • takeown - access denied
  • fileacl /force - access denied
  • cacls.exe, xcacls.exe - no luck

Unlocker found that Windows Media Player was locking the file. If I remember correctly, I did have a video file in that folder, but I don't think I ever tried to open it using WMP. I copied the folder from a network location initially, and it's possible WMP might have accessed it during its background library crawling.

NOTE: it seems that older versions of Unlocker were bundled with adware (nothing nasty thought, some e-bay shortcuts from what I've seen). I simply unchecked these items during installation and everything was smooth.

| improve this answer | |
  • Well, I'll be darned. This software reported no issues and no locking handle found. However, it had an option to delete/rename/move the folder anyway, which I did. And that ugly file went away... poof. Thanks. – Magnus Jul 17 '10 at 12:06
  • Same for me, it reported no locks, tried to delete it, could not, offered to schedule a delete on next system restart - and that did it. So I guess it was locked and owned by some system process. Of this is on Win10 by the way. – Alexander Abramov Jan 21 '17 at 17:50
  • 3
    That is crapware... Why dont use the better, standard and builtin resmon.exe?? Resource Monitor>CPU>Associate Handles>Search Handles> Write in the text field the name of the locked file or folder, and press, "Search". Voila. – Brethlosze Aug 29 '17 at 5:29
  • @hyprfrcb: seems like a better option indeed, so add this as an answer, it's better than posting it as a comment. Perhaps OP can even accept is as the correct answer since mine is rather outdated. – Groo Aug 29 '17 at 8:18
3

I can't get any higher in the hierarchy than Administrator

Sure you can. The local System account has higher privileges than Administrator. To start a command prompt under the System account, issue the command

at (time) /interactive cmd.exe

Where (time) is the current time plus 1 minute. Alternatively, download Sysinternals' PSTools and use

psexec -i -s cmd.exe

The elevated command prompt will start in a different directory from usual, which for me is

C:\WINDOWS\system32>
| improve this answer | |
  • 1
    @Hugh. Nope, sorry Local System didn't do anything. Question updated. – Magnus Apr 14 '10 at 5:16
0

You can try using Tizer Unlocker (freeware)

Here are some of the error messages that can be dealt with Tizer:

The file is in use by another program or user. Cannot delete file: It is being used by another person or program. Cannot delete folder: It is being used by another person or program. Cannot delete file: Access denied. The source or destination file may be in use. The process cannot access the file because it is being used by another process. There has been a sharing violation. Close any programs that might be using the file and try again. Make sure the disk is not full or write-protected and that the file is not currently in use. Error deleting file or folder. Cannot delete file or folder: The file name you specified is not valid or too long. Specify a different file name.

| improve this answer | |
  • Thanks, but there is nothing locking the file. – Magnus Apr 12 '10 at 20:49
-1

A caution: If the file is in the Windows directory or somewhere sensible, be careful about deleting it.

First, try booting in Safe mode to delete the file.

Second, sometimes the file is locked by explorer.exe itself. To solve such a problem:

  1. In Safe mode, launch a Command Prompt (cmd) as administrator
  2. Navigate in cmd to the directory in question and enter (but do not execute) a "del" command for the file in question
  3. Use Task Manager to kill explorer.exe
  4. Quickly press Enter in the cmd window to delete the file, before Windows restarts explorer

Third, the free utilities MoveOnBoot or Unlocker can be used to schedule delete of the file at boot time.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.