I definitely agree with Darren, but as Siyang has is set up right now he will produce a dictionary with keys for every feature class name found and the only item entry will be the same feature class path. This will essential attempt to merge a single feature class for each dictionary key.
If Siyang's folder structure is set up with a workspace folder with multiple folders containing many shapefiles of the same type then he could modify his code like this:
import arcpy, os
workspace = r'C:\Users\xxx\Desktop\boundary'
output_folder = r'C:\Users\xxx\Desktop\New folder'
Dict = {}
for root, dirs, files in os.walk(workspace,topdown=True):
for dir in dirs:
env.workspace = os.path.join(root,dir)
Dict[dir]=[]
for fc in arcpy.ListFeatureClasses():
if not fc in Dict[dir]:
Dict[dir].append(os.path.join(root,dir,fc))
else:
Dict[dir].append(os.path.join(root,dir,fc))
for key in Dict:
output = os.path.join(output_folder,key) + '_merge'
arcpy.Merge_management(Dict[key], output)
print output + " created"
The code I previously posted would do the same thing, but it also allows for feature type filtering and also for a folder structure with a top level workspace with multiple folders each containing multiple subfolders with their own feature classes in them. Hope this helps!