import arcpy from arcpy import env # set workspace where shapefiles are located env.workspace = r"C:\data\temp\python" # create empty list list = [] # append each shapefile in workspace to list for shapefile in arcpy.ListFeatureClasses("*.shp"): list.append(shapefile) # import list of shapefiles into File Geodatabase feature dataset arcpy.FeatureClassToGeodatabase_conversion(list, r"C:\Temp\Python\Redlands.gdb\Data") # set workspace to File Geodatabase env.workspace = r"C:\Temp\Python\Redlands.gdb" # loop through each feature class in 'Data' feature dataset and add fields for fc in arcpy.ListFeatureClasses("*", "", "Data"): arcpy.AddField_management(fc, "SHEET_NAME", "TEXT", "", "", "50") arcpy.AddField_management(fc, "ENGINEER", "TEXT", "", "", "100") arcpy.AddField_management(fc, "PROJECT_NO", "TEXT", "", "", "50") arcpy.AddField_management(fc, "SHEET_NO", "TEXT", "", "", "50") arcpy.AddField_management(fc, "DATE", "TEXT", "", "", "50")
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.