I have updated the script with the above suggestion, but it still doesn't work. I even tried template = filepathname, but that didn't work either. is there any other suggestion/comments? Thanks.
import arcpy
# Set Workspace
arcpy.env.workspace = arcpy.GetParameterAsText(0)
#Access shapefiles
fcList = arcpy.ListFeatureClasses()
try:
# Projection template
template = arcpy.GetParameterAsText(1)
# Output folder
outFolder = arcpy.GetParameterAsText(2)
# Get the spatial reference
spatialRef = arcpy.Describe(template).SpatialReference
#Loop through shapfiles in folder and reproject
for fc in fcList:
fcspatialRef = arcpy.Describe(fc).SpatialReference
if fcspatialRef != spatialRef:
arcpy.Project_management(fc, outFolder + "\\" + fc, spatialRef)
# Return any errors
except:
arcpy.AddMessage(arcpy.GetMessages ())
# Print shapefile list
for fc in fcList:
print fc