I have about 20 shapefiles that all need to have the same attribute table fields. I have the attribute table fields all setup the way I want for one of the shapefiles. I want to copy this attribute table setup over to the other shapefiles. The entries of the tables are all empty for now, I just want to use the same columns/fields for all the shapefiles. How can I copy the attribute table into the remaining shapefiles? Using ArcInfo 10.0
Solved! Go to Solution.
Well this is baffling, here is the code I run:
import arcpy, time
arcpy.env.workspace = r'C:\Users\keith.addison\Documents\PythonStuff'
arcpy.env.overwriteOutput = True
template = 'ParcelDataAC150.shp'
fcs = arcpy.ListFeatureClasses('*Copy*')
starttime1 = time.time()
outCounter = 1
for fc in fcs:
newCopy = "output_" + str(outCounter) + '.shp'
arcpy.Copy_management(template, newCopy)
arcpy.Append_management(fc, newCopy, 'NO_TEST')
outCounter += 1
endtime1 = time.time() - starttime1
print 'Total time: ' + str(endtime1) +'s'
And it doesn't create any new shapefiles in the working directory or anywhere else, it also outputs the run time as 0.0s. I've tried running it with several different template shapefiles with varying populated and unpopulated field setups to no avail.
You've got your template and "other" shapefiles. In my example, my "other" shapefiles happened to have the word "Copy" in their file names. Do yours? The line fcs = arcpy.ListFeatureClasses('*Copy*') means find the feature classes with the word "Copy" in the file name. Do you have any such shapefiles?
That was it, thanks! Sorry about that, I'm still figuring out Python syntax.