Deleting stale fgdb lock files

    Table of contents
    No headers

     

    ArcGIS doesn't always clean up after itselg. For example if you try to uncompress a file geodatabase and get an error message like the one below, try delete *.lock within the fGDB using filesystem tools (e.g. windows explorer or a command shell).

    Replacing of data file in File GDB has failed on (name_of_layer)
       (Unspecified error;  (code 80004005)
    File: .\sources\GpSdcUncompressDatasetFunction.cpp, line: 250)
    File: .\sources\GpSdcUncompressDatasetFunction.cpp, line: 254
    Failed to execute (UncompressFileGeodatabaseData_4).
    End Time: Tue Jan 22 13:59:12 2008 (Elapsed Time: 1.00 seconds)
    

    Command shell example for deleting lock files. Replace %a with %%a to use in a script:

    cd somegeodatabase.gdb
    for /r %a in (*.lock) do del %a
    

     

    I've noticed stale locks years old hanging around. I run this from time to time just clean things up and have never encountered a problem. I believe it safe -- so long as care taken to not touch any other files -- as active lock files cannot be deleted in this manner.

    Sources:

    http://forums.esri.com/Thread.asp?c=93&f=985&t=218460 - File Geodatabase Schema Lock - Python

        Send feedback