Solved! Go to Solution.
Hi all
I've built a model in model builder (9.2) and need to export the resulting output shape files into a Geodatabase within the same directory.
Normally I would use the 'Feature class to Geodatabase' tool within model builder however there are different output shape files created each time I run the model therefore conventional tools are not apopropriate.
I'm fairly new to Python and need the barebones of a script that will cut shapefiles from a directory into my Geodatabase.
Thanks,
Tom
import arcgisscripting gp = arcgisscripting.create() inputLocation = "C:\shps" gp.Workspace = inputLocation fcs = gp.ListFeatureClasses() fcs.reset() fc = fcs.next() while fc: ### to work with a File GDB, then use the .gdb extension gp.FeatureClasstoGeodatabase(fc, inputLocation + "\\testFGDB.gdb") ### to work with a Personal GDB, then use the .mdb file extension instead gp.FeatureClasstoGeodatabase(fc, inputLocation + "\\testPGDB.mdb") gp.AddMessage(str(fc) + " loaded into GDB") fc = fcs.next()
Hi all
I've built a model in model builder (9.2) and need to export the resulting output shape files into a Geodatabase within the same directory.
Normally I would use the 'Feature class to Geodatabase' tool within model builder however there are different output shape files created each time I run the model therefore conventional tools are not apopropriate.
I'm fairly new to Python and need the barebones of a script that will cut shapefiles from a directory into my Geodatabase.
Thanks,
Tom
import arcgisscripting gp = arcgisscripting.create() inputLocation = "C:\shps" gp.Workspace = inputLocation fcs = gp.ListFeatureClasses() fcs.reset() fc = fcs.next() while fc: ### to work with a File GDB, then use the .gdb extension gp.FeatureClasstoGeodatabase(fc, inputLocation + "\\testFGDB.gdb") ### to work with a Personal GDB, then use the .mdb file extension instead gp.FeatureClasstoGeodatabase(fc, inputLocation + "\\testPGDB.mdb") gp.AddMessage(str(fc) + " loaded into GDB") fc = fcs.next()