import arcpy import os # Set the current workspace gdbInput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\PIR_MR98copy.gdb" gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb" arcpy.env.workspace = gdbInput # Create list of datasets in input gdb dsInput = arcpy.ListDatasets() #print dsInput #Create list of fc in ds for ds in dsInput: fcInput = arcpy.ListFeatureClasses(feature_dataset=ds) print fcInput
[u'AppraisalPoint'] [u'BlockHubs', u'BlockPolygon'] [u'RoadLine', u'RoadCrossing', u'RoadNotes', u'RoadHubs'] [u'RiparianLine', u'Riparian_SMZ_Buffer', u'LakeWetland', u'LakeWetlandLine']
Solved! Go to Solution.
import arcpy import os # Set the current workspace gdbInput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\PIR_MR98copy.gdb" gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb" arcpy.env.workspace = gdbInput # Create list of datasets in input gdb dsInput = arcpy.ListDatasets() #print dsInput #make empty list to append file paths to. fclist = [] #Create list of fc in ds for ds in dsInput: fcInput = arcpy.ListFeatureClasses(feature_dataset=ds) for fc in fcInput: filepath = [gdbOutput+ "/" + ds + "/" + fc] fclist.append(filepath) arcpy.env.workspace = gdbOutput for path in fclist: if not arcpy.Exists(path): print "no {}".format(path) else: print "yes {}".format(path) import arcpy import os # Set the current workspace gdbInput = "C:\Users\iamurray\Desktop\Test.gdb" gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb" arcpy.env.workspace = gdbInput # Create list of datasets in input gdb dsInput = arcpy.ListDatasets() #print dsInput #Create list of fc in ds for ds in dsInput: fcInput = arcpy.ListFeatureClasses(feature_dataset=ds) for fc in fcInput: print gdbInput + "/" + ds + "/" + fc
Really, you just need to iterate through each feature class, and concatenate the workspace, the feature dataset and feature class name together.import arcpy import os # Set the current workspace gdbInput = "C:\Users\iamurray\Desktop\Test.gdb" gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb" arcpy.env.workspace = gdbInput # Create list of datasets in input gdb dsInput = arcpy.ListDatasets() #print dsInput #Create list of fc in ds for ds in dsInput: fcInput = arcpy.ListFeatureClasses(feature_dataset=ds) for fc in fcInput: print gdbInput + "/" + ds + "/" + fc
This gives me
C:\Users\iamurray\Desktop\Test.gdb/Test1/TestFC2
C:\Users\iamurray\Desktop\Test.gdb/Test/TestFC
import arcpy
import os
# Set the current workspace
gdbInput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\PIR_MR98copy.gdb"
gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb"
arcpy.env.workspace = gdbInput
# Create list of datasets in input gdb
dsInput = arcpy.ListDatasets()
#print dsInput
#Create list of fc in ds
for ds in dsInput:
fcInput = arcpy.ListFeatureClasses(feature_dataset=ds)
for fc in fcInput:
list = [gdbOutput+ "/" + ds + "/" + fc]
print list
arcpy.env.workspace = gdbOutput
for path in list:
if not arcpy.Exists(path):
print "no {}".format(path)
else:
print "yes {}".format(path)
import arcpy import os # Set the current workspace gdbInput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\PIR_MR98copy.gdb" gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb" arcpy.env.workspace = gdbInput # Create list of datasets in input gdb dsInput = arcpy.ListDatasets() #print dsInput #make empty list to append file paths to. fclist = [] #Create list of fc in ds for ds in dsInput: fcInput = arcpy.ListFeatureClasses(feature_dataset=ds) for fc in fcInput: filepath = [gdbOutput+ "/" + ds + "/" + fc] fclist.append(filepath) arcpy.env.workspace = gdbOutput for path in fclist: if not arcpy.Exists(path): print "no {}".format(path) else: print "yes {}".format(path) Easiest thing to do would to create an empty list outside of your loop, then have each file path append itself to the list.import arcpy import os # Set the current workspace gdbInput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\PIR_MR98copy.gdb" gdbOutput = "Q:\PIR\GIS\Brett\GDB Import Tool\Test Data\EmptyGisDeliverables_v14.gdb" arcpy.env.workspace = gdbInput # Create list of datasets in input gdb dsInput = arcpy.ListDatasets() #print dsInput #make empty list to append file paths to. fclist = [] #Create list of fc in ds for ds in dsInput: fcInput = arcpy.ListFeatureClasses(feature_dataset=ds) for fc in fcInput: filepath = [gdbOutput+ "/" + ds + "/" + fc] fclist.append(filepath) arcpy.env.workspace = gdbOutput for path in fclist: if not arcpy.Exists(path): print "no {}".format(path) else: print "yes {}".format(path)