import arcpy, os arcpy.env.workspace = os.getcwd() # For each ws, print the fc's and tbl's. for ws in arcpy.ListWorkspaces("*", "FileGDB"): arcpy.env.workspace = ws # feature classes for fc in arcpy.ListFeatureClasses(): print "fc: "+fc # tables for tbl in arcpy.ListTables(): print "tbl: "+tbl # feature classes in datasets for ds in arcpy.ListDatasets(): print "ds: "+ds for dfc in arcpy.ListFeatureClasses("*", "All", ds): print "fc in ds: "+dfc
If you have v10.1 SP1, I have found the new arcpy.da.walk function to be very handy: http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000023000000
import os, subprocess for root, dirs, files in os.walk(os.getcwd()): for dir in dirs: if dir.endswith(".gdb"): fullpath = os.path.abspath(os.path.join(root, dir)) print "\nfullpath: "+fullpath print "dir: "+dir
# For each ws, print the fc's and tbl's. for ws in arcpy.ListWorkspaces("*", "FileGDB"): arcpy.env.workspace = ws # feature classes for fc in arcpy.ListFeatureClasses(): print fc # tables for tbl in arcpy.ListTables(): print tbl # feature classes in datasets for ds in arcpy.ListDatasets(): arcpy.env.workspace = ds for dfc in arcpy.ListFeatureClasses(): print dfc
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.