i have a folder that has line 700 sub folders. each one has at least one shape file in it. i would like to take all 700+ and put them in a geodatabase and then start going thru them. how do i do this. python or model builder is ok
YES
so is the test data the folder with the sub folders in it? and then it pulls the feature class name and then converts it to the gdb?
Hi lela,
You could also use Feature class iterator and Feature class to feature class (Conversion tool) in a model builder.
Remember to check Recursive (optional).
The examples in the help show the basic pattern: use walk() to populate a list of files, for each file (possibly meeting a criteria, like being a shapefile) do something. Your something is to copy into a mdb.
I reworked a bit of an old script I had, but this should be close to what you need (Untested).
The original post that is based off of is here if you need more refernece. https://community.esri.com/thread/107816
import arcpy import os workspace = r"workspacepath" out_mdb = r"filepathtomdbhere" for dirpath, dirnames, filenames in arcpy.da.Walk(workspace,datatype="FeatureClass"): for filename in filenames: arcpy.CopyFeatures_management(os.path.join(dirpath , filename) , os.path.join(out_mdb , filename.strip(".shp")))
Have you tried anything yet?
Can't find any pre-made solution?
How familiar you with modelbuilder or python? Do you have a sample you are having problems with?
What do you intend to do with them when you get them there? Just look at them? Why no just use arccatalog to preview them if that is all you need.
ya but how do you put that together.
walk thru this folder and when you get .shp move it to mdb.?
1.) Walk through your nested folders: either os.walk() or arcpy.da.Walk() would work
2.) Import, one by one, into your mdb (many possible tools. Perhaps, Copy Features)
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.