Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm looking for a way to search Geodatabase's for files? Is there any function like this available?

Obviously windows search only returns the random ID's for the tables within a Geodatabase. I'd like to actually search for data sets within them.

I know this question would probably help a lot of people, because I know I'm not the only one out there who stores spatial data in Geodatabases, only to archive it with a thousand other datasets and not want to sift through it.

I'd like to search these Geodatabases within ArcCatalog.

share|improve this question

closed as unclear what you're asking by PolyGeo, Fezter, Devdatta Tengshe, BradHards, Chad Cooper Apr 2 at 11:56

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

What about using a List function with a wildcard? Or better yet the walk function? –  Barbarossa Mar 28 at 13:44
Geodatabases don't have files -- they have tables. What are you searching for? Table names or field contents? –  Vince Mar 28 at 13:54
The spatial datasets are tables. How can you search them without searching tables? –  Vince Mar 28 at 14:39
Using Windows Explorer is a new requirement; you'll need to edit the question so that an "That's impossible" Answer can be written. –  Vince Mar 28 at 14:43
So now we're down to what you're searching for -- Only the contents of string/clob fields? Is the search case-sensitive? Full table scans on every non-numeric/date column in every table will take a long time. –  Vince Mar 28 at 14:51
show 7 more comments

2 Answers 2

up vote 2 down vote accepted

This is a long way of doing what you're asking, using some python:

  1. You need a list of all the GeoDatabases that you want to search. If there are a lot, use python's walk function on the directory in question. Isolate for any folders with a .gdb in them or .mdb, depending on the database.

  2. Find all the datasets within the GeoDatabase.

  3. Find all the layers within the dataset.

  4. Search results from layers for what you are looking for.

Here is a code sample of what I'm talking about:

import arcpy
from arcpy import env
x = 'File Name That You Are Looking For'
GDBs = ['GeoDatabase1', 'GeoDatabase2', 'ect']  # Your list of GeoDatabases
for GDB in GDBs:                                # Iterate through your list
    env.workspace = GDB
    GDBds = arcpy.ListDatasets()                # Find datasets in GeoDatabase
    for ds in GDBds:                            # Iterate through datasets
        env.workspace = GDB + '/' + ds
        fc = arcpy.ListFeatureClasses()         # Find all data in the dataset
        for f in fc:
            if f.find(x) != -1:
                print GDB + '/' + ds + '/' + f    
share|improve this answer
Beauty answer! I think I'd change: f == x to f.upper() == x.upper() That way there is no way to hase case sensitive things get in the way. It'll also be great to work in a wildcard into it as well. –  Cody Brown Mar 28 at 15:04
Good idea. Also thanks to @Barbarossa for his comment. That comment really translated into this answer. –  OtonabeeGIS Mar 28 at 15:07
Not all feature classes are in feature datasets (best practice would result in very few) –  Vince Mar 28 at 15:30
add comment

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).

import arcpy, os
workspace = "Path/to/folder"
search = "name_string_you_are_searching_for"
feature_classes = []
for dirpath, dirnames, filenames in arcpy.da.Walk(workspace,
    for fname in filenames:
        # search for string in string to eliminate the need for exact filenames
        if search.upper() in fname.upper():
            feature_classes.append(os.path.join(dirpath, fname))

The resulting list will contain the paths and filenames of all feature classes that match your search criteria, which can be printed.

for fc in feature_classes:
     print fc

The walk function can also be modified to search for specific types of features (i.e. polygons, points, rasters, etc) by changing type="" to the feature type.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.