@@ -0,0 +1,1345 @@
+# coding: utf-8%0Aimport os%0Aimport arcpy%0A%0A%0A#Merge a lot of shapefiles with the same name from different subdirectories to a feature class a gdb%0A%0A#basefolder%0Afolder = %22Z:%5C%5CE%5C%5Caso%5C%5CEurope_Navstreets_shp_wgs84%22%0A%0A#output gdb%0AoutGdb = %22Z:%5C%5CE%5C%5Caso%5C%5CEurope_Navstreets_shp_wgs84%5C%5CEuNavstreet.gdb%22%0A%0A%0A# dict with shapefile name as key and array of path as value%0A# %7B'a.shp' : %5B'c:/dir1/a.shp','c:/dir2/a.shp','c:/dir3/a.shp'%5D%7D%0AshapefileDic = dict()%0A%0A#loop in all directories and subdirectories%0Afor path,dirnames,filenames in os.walk(folder):%0A        for filename in filenames:%0A                if filename.endswith(%22.shp%22):%0A                        #get the full path%0A                        fullpath =  path+'%5C%5C'+filename%0A                        #if not already in the dic, add it%0A                        if not filename in shapefileDic:%0A                            shapefileDic%5Bfilename%5D = %5Bfullpath%5D%0A                        #if it already exist, add the new shapefile path to the array%0A                        else:%0A                             shapefileDic%5Bfilename%5D.append(fullpath)%0A%0A#we have a dic with all the shapesfiles path%0A#print shapefileDic%0A%0A#merge them%0Afor filename in shapefileDic:%0A        #we strip .shp%0A        featurename = filename%5B:-4%5D%0A        print featurename%0A        arcpy.Merge_management(shapefileDic%5Bfilename%5D,outGdb+%22/%22+featurename)%0A

Add merge shape script