I have 39 shapefiles in a folder with each shp having 368 attributes. Every shapefile has the same attribute name (FID, pointid, grid code and 365/366 others; depending on them being leap year).
I wanted to know whether the code below joins all the attributes from every shapefile to one shapefile or every attribute from other shapefiles to each shapefile i.e. If I have 50 shapefiles numbered 1 to 50 and I want to join fields from all the 49 shapefiles to shapefile 1, what changes (if any) would I have to make to the code. I only want one shapefile with attributes from every other shapefile.
import arcpy arcpy.env.workspace = r'C:\path\to\your\shapefiles_folder' join_field = "DATE" join_table = r'C:\path\to\your\jointable.dbf' shps = arcpy.ListFeatureClasses() counter = 1 for shp in shps: arcpy.JoinField_management(shp, join_field, join_table, join_field) print "%s of %s shapefiles processed" % (counter, len(shps)) counter += 1 print "Processing complete."