Select to view content in your preferred language

Retrieving FULL file path in GDB - Describe()

1938
1
10-04-2011 03:59 PM
JensTolsdorf
Emerging Contributor
As an example:
If I have the FeatureClass 'Highway' located in "C:\Users\JohnCitizen\Documents\ArcGIS\Default.gdb\Roads\Highway" where Roads is a FeatureDataset, how do I retrieve "C:\Users\JohnCitizen\Documents\ArcGIS\Default.gdb\Roads" as the full file path?

All the Describe Object properties (e.g. arcpy.Describe(Highway).path or arcpy.Describe(Highway).catalogPath) seem to return "C:\Users\JohnCitizen\Documents\ArcGIS\Default.gdb" or "C:\Users\JohnCitizen\Documents\ArcGIS\Default.gdb\Highway".
Tags (2)
0 Kudos
1 Reply
JakeSkinner
Esri Esteemed Contributor
I wasn't able to find a way to accomplish this just using the Describe function, but was able to get the full path by combining the Describe function with some OS functions and looping through each feature dataset.  Ex:

catalogPath = arcpy.Describe("Highway").catalogpath

for FD in arcpy.ListDatasets("*"):
    for FC in arcpy.ListFeatureClasses("*", "", FD):
        if os.path.basename(catalogPath) in FC:
            fullPath = os.path.dirname(catalogPath) + os.sep + FD + os.sep + FC
            print fullPath
0 Kudos