I currently have code that re-projects all my shapefiles in a folder based off an input shapefile that I select. I will attach the code below. The code runs fine, but I would like the message on the geoprocessor window to say "Projected feature1, feature2, feature3, etc"
I currently can only get the script to list: "Projected feature1" "Projected feature2" "Projected feature3"
Like this:
I need the result to be:
It's basically printing the message for each iteration of the loop but I need it to print each feature class selected. Hopefully that makes sense. Attached is my example script below.
import arcpy
folderLocation = arcpy.GetParameterAsText(0)
targetShapefile = arcpy.GetParameterAsText(1)
try:
targetDescribe = arcpy.Describe(targetShapefile)
targetSpatialRef= targetDescribe.spatialReference
targetSpatialName = targetSpatialRef.Name
arcpy.env.workspace = folderLocation
featureList = arcpy.ListFeatureClasses()
for fc in featureList:
desc = arcpy.Describe(fc)
spatialRef = desc.spatialReference
fcName = spatialRef.Name
if fcName != targetSpatialName:
rootName = fc.replace(".shp", "")
outfc = folderLocation + '\\' + rootName + "_Projected"
outCS = targetSpatialRef
arcpy.Project_management(fc, outfc, outCS)
arcpy.AddMessage("Projected "+ fc)
except:
print arcpy.GetMessages()