3

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?

Bill the Lizard
  • 352
  • 1
  • 7
  • 15
user168507
  • 131
  • 1
  • In my case, I discovered using the [`net file`](http://serverfault.com/a/391290/247168) command that a folder I was unable to delete was open by another user on the network. – DavidRR Oct 08 '14 at 15:25

2 Answers2

4

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 
Ciove
  • 211
  • 2
  • 8
1

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?

Brent Pabst
  • 6,059
  • 2
  • 23
  • 36