AnsweredAssumed Answered

Error with Merge Management when using arcpy.da.Walk

Question asked by iamurray on Sep 4, 2014
Latest reply on Sep 10, 2014 by daveb1034

Hey all,


I had a goal of making a single shapefile from all the shapefiles I had in a directory, (I have 800 or so), since its hard to share all 800 with someone at once.  I wrote up the following script that I hoped would take care of it using the Merge Tool.


import arcpy
import os
workspace = r"myworkspace"
feature_classes = []
for dirpath, dirnames, filenames in arcpy.da.Walk(workspace,datatype="FeatureClass", type="Polygon"):
    for filename in filenames:
        if filename.endswith(".shp"):
            feature_classes.append(os.path.join(dirpath, filename))
            print filename
print feature_classes
arcpy.Merge_management(feature_classes, r"C:/Data/test.shp")


However, I keep getting the  following error.


ExecuteError: Failed to execute. Parameters are not valid.


Merge only takes 3 parameters, so I am failing to see the issue.