maphew

Identify or list open files

December 30, 2021

Got the dreaded "you can't delete or rename this folder because it's open in another program" error?

Local machine

Article Image

Sysinternals suite includes command line tool Handle, that lists open handles.

handle name-fragment-i-cant-delete

From <https://serverfault.com/questions/1966/how-do-you-find-what-process-is-holding-a-file-open-in-windows>

Article Image

 

Remote Machine

Openfiles is an official MS tool, which I discovered today and haven't used yet:

openfiles /disconnect /s srvmain /u maindom\hiropln /id *

Psfiles I've used several times to great effect:

Open command prompt and close any open files in the target folder.

WARNING: this OS level command bypasses ArcGIS entirely. It's only safe if all file open handles are in read mode.  The first command shows the open files and their mode. The second closes them (-c). The drive letter is local-to-server and not what you see on your machine.

psfile \\envgeoserver G:\share\repository\v5\SurfaceDisturbance.gdb
psfile \\envgeoserver G:\share\repository\v5\SurfaceDisturbance.gdb -c 

Psfile is also part of the SysInternals suite.