Anyone know how to create a looping statement that adds all the GIS layers from a folder? Using arcpy.mapping.
Here is what I got:
arcpy.env.workspace = '#whatever the folder is' mxd = arcpy.mapping.MapDocument("Current") fclist = arcpy.ListFeatureClasses() for fc in fclist: .....#something to add to your feature classes
Think this should work. I tested it on a folder of shp files.
arcpy.env.workspace = "WORKSPACE"
mxd = arcpy.mapping.MapDocument('CURRENT')
fclist = arcpy.ListFeatureClasses()
for fc in fclist:
name = fc.split(".") #Splits the .shp from the name
arcpy.MakeFeatureLayer_management(fc,name[0])