I'm new to Python and just created a hard coded script for the process I want, and it works. Right now it calls on the one of three shapefile I have in this map document. I want it to do the same thing, but for each shapefile in this folder. I have no idea how to go about this! I always use ModelBuilder, so I know that is should be an iteration.
Does anyone have any idea how to go about this, or how I am supposed to change this code?
import arcpy
#Declaring Variables
ID = arcpy.GetParameterAsText(0)
OutputLocation = arcpy.GetParameterAsText(1)
mxd = arcpy.mapping.MapDocument(r"C:\Users\m3rexkac\Desktop\Rename_Test\DOE_auto.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"*")[0]
#Now to Create a Layer Object, the line of code below returns a list of all the layers in the dataframe, with this name. The [0] returns the first layer with that name instead of the whole list
Layer = arcpy.mapping.ListLayers(mxd, "Mary_Creek_Co_Parcels", df)[0]
#This zooms the dataframe to the selected feature
lyr = arcpy.mapping.ListLayers(mxd,"Mary_Creek_Co_Parcels", df)[0]
extent = lyr.getExtent()
df.extent = extent
df.scale = scale
#Exporting map dataframe view to pdf, I have it set up to save
arcpy.mapping.ExportToPDF(mxd, OutputLocation + "2.pdf", "Page_Layout", 640, 480)
#Cleaning out memory by deleting the python objects
del mxd
del df
del Layer

arcpy.mapping.Layerandarcpy.mapping.AddLayer, such as in this thread: https://gis.stackexchange.com/questions/4882 and this documentation page: http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/addlayer.htm. What have you tried to identify the shapefiles? I useglob, but you can also usearcpy.ListFeatureClassesorarcpy.da.Walk. – SMiller Nov 15 '18 at 18:44