I have a problem I'm trying to solve. I want to join serval CSV files to a feature class, I would like to create one new feature class for each CSV files. If it's possible each fc would be named after the CSV file used.
For example if I have: abc.csv and zxy.csv I want to feature class to be named , with each fc corresponding to one of the csv file, abc and zxy.
inFeatures = r"path to my feature class" layerName = "fc_layer" joinTables = r"path to the folder where my CSV files are" joinFieldlyr = "CI_INT" joinFieldtab = "CI" outFeature = r"path to the folder dataset where I want my feature class" arcpy.MakeFeatureLayer_management(inFeatures, layerName) arcpy.AddJoin_management(layerName, joinFieldlyr, joinTables, joinFieldtab) arcpy.CopyFeatures_management(layerName, outFeature)
That code work perfectly for one file but I can't get the name part right. I tried to use os.path.join and os.path.splitext so I can find and use the name of my files but without any succes. I also tried to code a loop to iterate trough my folder so I don't have to do it manually.