You could get a list of the featuredatasets using the ListDatasets
function, then loop through that list to get at the featureclasses within each featuredataset. From the docs:
datasetList = arcpy.ListDatasets("C*", "Feature")
for dataset in datasetList:
print dataset
I would personally use arcpy.MakeQueryTable_management and then use that table to create a new featureclass with that as its template.
Please note, that the layer that is created by the tool is temporary and will not persist; you have to use the item created by this, in creating a permanent table
Alternatively, you could just code the creation of the table using arcpy.CreateTable_management, with something like this:
arcpy.CreateTable_management(InputWorkspace,TabName,"",VectorConfigKeyword)
# Process: Add Field
for field in [TabField1,TabField2,TabField3,TabField4,TabField5]:
arcpy.AddField_management(InputWorkspace + "\\" + TabName, field[0], field[1], field[2],field[3], field[4], field[5], field[6], field[7], field[8])
arcpy.AddIndex_management(InputWorkspace + "\\" + TabName,IndexParams[0],IndexParams[1],IndexParams[2],IndexParams[3])
TabField1 = ["ID","LONG","","","","","NON_NULLABLE","REQUIRED",""]
TabField2 = ["Name","TEXT","","","255","","NON_NULLABLE","REQUIRED",""]
etc
IndexParams = ["ID",TabName + "_RID_IDX","UNIQUE","ASCENDING"]
That way you can design and build your FC anytime you like.
Best Answer
Another way to search for feature classes, which may or may not be in a dataset is to use the
walk
function, as mentioned before. It requires only a workspace to search in (i.e. a folder containing hundreds of GDBs).The resulting list will contain the paths and filenames of all feature classes that match your search criteria, which can be printed.
The
walk
function can also be modified to search for specific types of features (i.e. polygons, points, rasters, etc) by changingtype=""
to the feature type.