I am trying to create a Python script that will be able to rename the first field in a shape file by adding a new field, then calculating the new field to equal the first field. The problem is that in each shape file, the first field will have a different name. I tried using a listfield to extract the name of the first field, but when I tried to calculate using it, the rows of the new field became populated with the name of the first field, not its value.
import arcgisscripting # Create the geoprocessor object gp = arcgisscripting.create(9.3) gp.OverWriteOutput = True # Set the workspace. List all of the folders within gp.Workspace = "C:\ZP44" fcs = gp.ListWorkspaces("*","Folder") # for fc in fcs: print fc gp.MakeFeatureLayer(fc + "\\Parcels.shp", "parcs") fieldList = gp.ListFields("parcs") print fieldList.Name field1 = fieldList.Name gp.CalculateField_management("parcs", "Apn", "field1", "PYTHON", "")