# Why can't I delete the file 'favicon.ico' in Windows Server 2008?

I have copied the file favicon.ico from one website folder to another in Windows 2008.

Now I can't delete this file, nor can I change its owner in the security tab even as an administrator.

How can I regain access?

-
In my case, I discovered using the net file command that a folder I was unable to delete was open by another user on the network. –  DavidRR Oct 8 at 15:25

I've found the Sysinternals Handle to be a handy (and free) tool for these purposes.

C:\path\to\handle.exe c:\path\to\favicon.ico


However, handle.exe works only with local handles, and it doesn't tell who's got the file open. This VBS script finds out who has the file open and it can check files on a remote server:

' WhosGotItOpen.vbs
strServername = "."         ' A dot is the same as current computer.
' If you want to check remote server, replace dot with the name of the server.
strFilename = "myfile.ext"  ' Put the name of your file here.
' Can be also be piece of the path, like: "folder\myfile"
Set objFileSystem = GetObject("WinNT://" & strServername & "/LanmanServer")

If (IsEmpty(objFileSystem) = False) Then
For Each Resource In objFileSystem.Resources
If (Not Resource.User = "") And (Not Right(Resource.User,1) = "\$") Then
If Instr(1, Resource.Path, strFilename ,1) > 0 Then
WScript.Echo Resource.user & ";" & Resource.Path
End If
End If
Next
Else
WScript.Echo "Error in filesystem , quitting."
WScript.Quit(2)
End If

-

Sounds like the file has an open handle preventing any modifications of it. Have you tried running Process Explorer or some other utility to search for open file handles and see what process has it locked?

-