I want to create a python script (ArcGIS 10.1) where I loop through a GDB with several feature classes and select all the fields which are of text type and convert them to float type. I always want to skip the first 10 and last 2 fields of each featureclass as they actually are supposed to be of text type. I am not quite sure how to do so.. I guess FeatureClassToFeatureClass_conversion does the trick but I am a bit lost.
This is as far as I got:
(I asked the same question on Stackexchange as I need an answer asap: http://gis.stackexchange.com/questions/150723/convert-field-types-in-gdb-with-python)
# Import system modules
import arcpy
from arcpy import env
env.overwriteOutput = True
# Set environment settings
env.workspace = "D:\Test\2011_LongNames.gdb"
inFeatures = arcpy.ListFeatureClasses("*")
outLocation = "D:\Test\FLOAT.gdb"
outName = ??? same as inFeature
field_mapping = ???? part where it converts text fields to float fields
listFCs = [f.name for f in arcpy.ListFields(env.workspace)]
listFCs = listFCs[10:len(listFCs)-2)]
for fc in listFCs:
arcpy.FeatureClassToFeatureClass_conversion(inFeatures, outLocation, outName, field_mapping )