A lot depends on how your data are stored. If your data store has grown organically and the data are jumbled in a load of directories and mix of shapefiles and geodatabases, you could use the Python os.walk function to list your directory structure and then subset your list to include only GDBs and SHPs. You would then need to recursively work through each dataset in the GDBs and each of the SHPs. This approach is a bit brute force but you could farm it out to a few CPU cores with a bit of threading and judicious use of the subprocess module.
If your data are neatly in a single database (whether that be a file-based geodatabase or SDE) your life should be a lot easier. You just then recursively walk through the database structure (using SQL and not the os.walk function obviously)
EDIT following Visceral's comments:
Given that your directory tree includes mostly shapefiles you need to sift your files to only include the ones ending in '.shp'. Even if they ONLY contained shapefile, your are still only interested in the ones with the '.shp' extension. There's a few ways of doing this but here's an example:
def dirsearch(basedir):
'''Gets all the shapefiles in the directory structure'''
shpList = []
for dirpath,dirnames,filenames in os.walk(basedir):
shpList.extend([os.path.join(dirpath, fnm) for fnm in filenames if fnm.endswith('.shp')])
return shpList
basedir = sys.argv[1]
#dirnames uses a recursive function to list subdirs: def dirsearch(basedir): [dirpath,dirnames,filenames]=os.walk(basedir) if dirnames.length == 0 intersectfeatures(dirpath) else: for dir in dirnames: dirsearch(dir)
a method that does the intersecting of all fcs in a directory
def intersectfeatures(dirpath): arcpy.envworkspace=dirpath fclist=arcpy.ListFeatureClasses() for fc in fclist:
– Visceral May 02 '12 at 19:38this = "an example". – blah238 May 02 '12 at 20:48