I'm having a bad time trying to create a script capable of merging a list of arcinfo coverages located inside a folder structure. My goal is to merge the coverages named "car" that are inside each of 500 folders. The field definitions are the same for all the "car" coverages.
My unsuccessful approach has been first to create a list with the path of each folder and second apply the arcpy.ListDatasets function to each of the folders and append (or merge) each of the coverages to an initial empty shapefile.
I'm new in Python and a simple task like this has become hours of trial and error. I hope someone here can guide me through the best solution.
This is the code I have so far (with indentation error on line 21):
import arcpy from arcpy import env import os outlocation = "W:/forestal/1_25k_carreteras" folderspath = "W:/forestal/cartografia/hojas_1_25k" emptyshp = "1_25k_car.shp" folderslst =  arcpy.CreateFeatureclass_management(outlocation, emptyshp, "POLYLINE") for dirname, dirnames, filenames in os.walk(folderspath): for subdirname in dirnames: folderslst.append(os.path.join(folderspath,dirname)) for folder in folderslst: arcpy.env.workspace = folder coverageslst = arcpy.ListDatasets("car", "Coverage") arcpy.Append_management(coverageslst, outLocation + os.sep + emptyshp)