Select to view content in your preferred language

Searching for feature classes using Python script

855
5
03-08-2011 08:13 AM
KevinHighland
Frequent Contributor
Hi all,

I'm wondering if it's at all possible to create a python script that can search for a particular feature classe in all mxds within a folder and all its subfolders. I would also like it to create an output .txt report similar to what MultiMXDReport.py does, but it would create a list of mxds that contain just the specified feature class.

For example, if I specify "Transmission_Main" as the feature class and "T:\\Maps\" as the folder path, it would create a list of all mxds within "T:\\Maps\" that contain the "Transmission_Main" feature class.

I'm very new to Python, and any thoughts or clues to put me in the right direction would be greatly appreciated.

Thanks,
Kevin
0 Kudos
5 Replies
JeffBarrette
Esri Regular Contributor
Hello Kevin,

Have you tried the Find Data Source sample?  I think it does exactly what you want.  You mention the multi-mxd reporter tool so I assume you are familiar with the arcpy.mapping sample script tools on the resource center.

If not, try the following link:
http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=A910AB18-1422-2418-3418-3885D...

Jeff
0 Kudos
KevinHighland
Frequent Contributor
Jeff,

Thanks for the response. That is the tool I was looking for.

My only problem now is that the feature classes I'm interested in are stored on a 9.3 version SDE. Is there any way to get around this? I'm thinking the answer is no, so I'll just have to wait until will upgrade it to 10.

Thanks again.
K
0 Kudos
JeffBarrette
Esri Regular Contributor
Kevin,

The script must run on a 10.0 machine because arcpy.mapping is new at 10 but it should not matter that the feature classes are coming from a 9.3 SDE source.

Please let us know if there is a problem,
Jeff
0 Kudos
KevinHighland
Frequent Contributor
The feature classes I'm interested in are stored on a 9.3 SDE source. When I run the tool to find feature classes stored on this SDE, the output text file shows that no sources were found - even though I am running it on maps that do contain the feature classes I am searching for.

However, the tool works perfectly when I run it on maps containing feature classes on our 10 SDE.

Is there any way to explain why this would be happening? Am I just missing something?


Thanks again,
Kevin
0 Kudos
JeffBarrette
Esri Regular Contributor
Are you running 10.0 SP1.  The was reported a long time ago but I believe it was not reproducible using SP1.
0 Kudos