I am trying to use a script to go through a folder full of geodatabases, open each geodatabase, and rename the feature classes inside the same name as the geodatabase it resides in.
For example, for a folder like this....
MyFolder Geodatabase1.gdb Points, Polylines Geodatabase2.gdb Polylines Geodatabase3.gdb Points
MyFolder Geodatabase1.gdb Geodatabase1_Points, Geodatabase1_Polylines Geodatabase2.gdb Geodatabase2_Polylines Geodatabase3.gdb Geodatabase3_Points
My code to do this is giving me the error
arcgisscripting.ExecuteError:Failed to execute. Parameters are not valid. ERROR 000840: The value is not a Data Element. Failed to execute (Rename). Can anyone see what might be the issue?
Here is my code:
outLocation = r"C:\Path\to\MyFolder" arcpy.env.workspace = outLocation MasterGDB = outlocation + 'excludedGDB.gdb' for fgdb in arcpy.ListFiles(): if fgdb.endswith('.gdb') and fgdb != MasterGDB: arcpy.env.workspace = os.path.join(outLocation, fgdb) featureDataset = arcpy.ListDatasets() featureClasses = arcpy.ListFeatureClasses(feature_dataset= featureDataset) for fc in featureClasses: in_data = fc out_data = fgdb +'_' + fc data_type= "FeatureClass" arcpy.Rename_management(in_data, out_data, data_type) else: print fgdb + " is not a gdb or has been otherwise excluded."