I work with arcview 10.3. I try to merge layer files in order to get one layer file that include all the features in the other layer files. All layer files as different names, and they all spread in big folder that divided to a lot of sub folders. My code is:
import arcpy,os,sys,string,fnmatch
import arcpy.mapping
from arcpy import env
rootPath = r"C:\Project\layers"
pattern = '*.lyr'
lyr2merge = []
counter = 0
for root, dirs, files in os.walk(rootPath):
for filename in fnmatch.filter(files, pattern):
lyr2merge.append(os.path.join(root, filename))
counter = counter + 1
arcpy.Merge_management(lyr2merge, r"C:\Project\layers\layer_total.lyr")
print 'merge'
print counter
i got an error:
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000840: The value is not a Table View.
ERROR 000840: The value is not a Table View.
ERROR 000840: The value is not a Table View.
Failed to execute (Merge).
i can merge shapefiles Merge shapefiles in folders and subfolders with arcpy but after that i will have to save it as layer file. Is it possible?