<type 'exceptions.NameError'>: name 'B' is not defined when I run this script.
Why is my 'B' not defined and is it a syntax error?
For clarification, I am trying to get the code to loop through specific shapefiles in the folder "\\My Documents\ArcGIS\..." and copy them into "\\My Documents\NewFolder\..." The A variable represents a list of the specific shapefiles I want to copy from a folder and into a new one; the issue I am having is defining B, where the individual variable name from A is automatically carried over/read in any part of the code. I am trying to tell Arc that every time it sees "+STATE+" (which should be seen as B: main issue) it must insert the specific variable name listed in A, process it (in this case copy), and then loop back to the next specified variable, until it reaches the end of the list.
I would like to copy the 'FL_RechargeArea' through 'GA_AreaofContribution' shapefiles from the "\\My Documents\ArcGIS\..." folder into the "\\My Documents\NewFolder\..." and get it to save as '(specific-varialbe-name)2.shp'.
It's much less about copying and more about being able to loop through and process specific shapefile names in a folder, rather than looping through and processing perhaps the entire list within a folder.
# Import arcpy module import arcpy for A in B: # Local variables: A = ['FL_RechargeArea','FL_AquiferProtectionArea','FL_AreaofContribution','GA_RechargeArea','GA_AquiferProtectionArea','GA_AreaofContribution'] B = "STATE" New_Shapefile = "\\\\My Documents\\ArcGIS\\"+STATE+".shp" Output_from_New_Shapefile = "\\\\My Documents\\NewFolder\\"+STATE+"2.shp" # Process: Copy Features arcpy.CopyFeatures_management(New_Shapefile, Output_from_New_Shapefile, "", "0", "0", "0")