I have multiple GDBs from an earlier process. Each GDB contains a single feature class (FC).
I want to copy (FeatureClassToFeatureClass) each FC into a "Main" GDB for later processing in a single place.
I thought nesting a for loop like below would work. It runs, but doesn't produce a result or an error, so it's unclear why it's not working.
I am using Python 2.7.14 in a Windows Server environment, running with ArcGIS Desktop Advanced (10.6).
#Import modules import arcpy import os #Target GDB outGDB = r"E:\Jamie_Temp\Main_GDB.gdb" #LIBRARIES #Set workspace arcpy.env.workspace = r"E:\Jamie_Temp\Test_Files" #Find GDBs inGDB = arcpy.ListWorkspaces() for gdb in inGDB: inFCs = arcpy.ListFeatureClasses() for fc in inFCs: arcpy.FeatureClassToFeatureClass_conversion(fc, outGDB, fc.strip("_point"))
The idea being here that it:
- Finds the name of all GDBs in the workspace and assigns them to
- Loops through each GDB found in
inGDBand list the FCs inside, assigning them to
- Copy the FCs found to