Hi again, i must be missing something when working with this script
i have around 250 shape file with the same name "contour" stored in different folders 1 to 250 store under C:\LINZ Topo Data\Topo50 Vector data - Shape\South island and have created a destation path called C:\LINZ Topo Data\Topo50 Vector data - Shape\Merge files.
But using the above code.....
import collections
import os
import arcpy
shape_files = collections.defaultdict(list)
##root = arcpy.GetParameterAsText(0)
##dest_path = arcpy.GetParameterAsText(1)
root = 'C:\LINZ Topo Data\Topo50 Vector data - Shape\South island'
dest_path = 'C:\LINZ Topo Data\Topo50 Vector data - Shape\Merge files'
for r, d, f in os.walk(root):
shapes = filter(lambda x: x.lower().endswith('contour.shp'), f)
for shape_file in shapes:
shape_files[shape_file].append(os.path.join(r, shape_file))
for file_name, file_list in shape_files.iteritems():
## arcpy.Merge_management(file_list, os.path.join(dest_path, file_name))
print '%s: %r' % (file_name, file_list)
But does not seam to work any ideas?