Select to view content in your preferred language

ArcCatalog Search for Feature Classes

04-10-2015 11:54 AM
Status: Open
Frequent Contributor III
Similar Idea to a Windows search of your hard drive.  This would be built into Catalog such that you could select a folder or hard drive and it will search all folders and subfolders for ShapeFiles and Feature Classes in file and personal geodatabases.

Say I have a feature I created for a specific task called SearchToolExplained and it resides in a database or as a shapefile in a folder and I cannot remember where I put it.  I could then in ArcCatalog search for SearchToolExplained and it would then search all Shapefiles and databases and find all instances of that Feature Class.
This python script will search vector but not raster layers....

import arcpy, sys, os

#arcpy.env.workspace = "D:\Lakeland_GIS\GDB\Lakeland\Lakeland.gdb"

orig_stdout = sys.stdout
f = file('gislayers.txt', 'w')
sys.stdout = f
feature_classes = []
for dirpath, dirnames, filenames in arcpy.da.Walk(workspace,datatype="FeatureClass"):
    for filename in filenames:
        feature_classes.append(os.path.join(dirpath, filename))
        thisline = "Dir Path, " + dirpath + ", Dataset, " + filename
        print thisline
sys.stdout = orig_stdout
I see a lot of people posting solutions wiht Python but I really have no idea what to do witht he script you posted.  

I used to write VB and looking at the script you posted it lookas as though it is only going to search a specified database.