There is a wonderful Add-in called X-ray for ArcCatalog. It has many features, but the one we ended up using was the 'Analyze Difference' tool from the Tools menu.
It finds for you the difference between a Geodatabase and an XML workspace Document. We just exported the schema of our Template Geodatabase to XML, and compared the different Geodatabases to it.
It hardly takes a couple of seconds to show a nice report with all the feature classes and fields that are missing or different in the two geodatabase.
To select a single feature class from a gdb, we query for all entities inside it:
-sql "select * from FEATURE_CLASS_NAME"
To generate a list of feature classes following your sample use nested FOR loops:
@echo off
for %%S in (01 02 03) do (
for %%F in (01 02 03) do (
echo ogr2ogr out.gdb in.gdb -sql "select * from Sec%%S_Frm%%F"
)
)
Emits:
ogr2ogr out.gdb in.gdb -sql "select * from Sec01_Frm01"
ogr2ogr out.gdb in.gdb -sql "select * from Sec01_Frm02"
ogr2ogr out.gdb in.gdb -sql "select * from Sec01_Frm03"
ogr2ogr out.gdb in.gdb -sql "select * from Sec02_Frm01"
...
From there add -nln OUT_LAYER_NAME
to say we want it all going to one place, and -nlt multipolygon
for geometry type. (NB: nlt is often automatically derived from input, but for some operations like this one geometry is omitted and you get just a table):
ogr2ogr out.gdb in.gdb -nln Form01 -nlt multipolygon -sql ...
And finally we will be updating existing data so:
ogr2ogr out.gdb in.gdb -update -append -nln ...
Useful options:
-config FGDB_BULK_LOAD YES
-skipfailures
How do I include the source filename in a field when merging hundreds of shapefiles (Windows)?
for %f in (*.shp) do (
ogr2ogr -sql "select *, '%~nf' as s_file from %~nf" -update -append merged\output.shp %f -nln output
)
Sources
By the way, if you still have the gdb with the "unwieldy number of feature classes" hanging around from previous attempts you might be able to just ogr2ogr -f FileGDB clean.gdb unwieldy.gdb -nln Clean_Form01 -nlt multipolygon
in one go.
Code samples are in Windows batch file syntax.
Thank you for this question. It prompted me to extend a related project that I've been needing to come back to.
I don't think ogrinfo can write, so that would be the origin of the lock error in the Dec 11 update.
Best Answer
First, welcome to the site!
To check your data back in you need to run Check-In (form the Data Manager Toolbar) for each of the AXF files. This will check modifications (edit, create & delete) back into the parent Geodatabase.
Note that if there are any conflicts, last in wins (ie, new data will overwrite existing data even if that data had changed since checkout). If this is a concern you should use replica geodatabases to check-out from and use ArcGIS Desktop tools to manage conflicts before committing edits to your original geodatabase.