hello,
For example, I have 3 .shp files ( points, polygon, polyline ) in a folder and within that folder, I also have a geodatabase with an empty point dataset.
how do I copy only the points shapefile into the point dataset within that geodatabase? i tried os.path.join but it doens't work.
Solved! Go to Solution.
source_path = r'C:/folder name/homes.shp'
out_loc = r'C:/folder name/new.gdb/Points'
out_name = 'homes'
arcpy.FeatureClassToFeatureClass_conversion(source_path, out_loc, out_name)
although it's a bit strange to resort to doing this in python, what are you actually trying to achieve? Is this just a coursework question?
Is it a point FC in a FGDB or a Feature Dataset in an FGDB or a Point FC in a Feature Dataset? Can you share your code?
hmm, i haven't wrote the code yet but what i essentially want is to copy over the homes point shape file to the points dataset within the new.gdb. thanks for your help
source_path = r'C:/folder name/homes.shp'
out_loc = r'C:/folder name/new.gdb/Points'
out_name = 'homes'
arcpy.FeatureClassToFeatureClass_conversion(source_path, out_loc, out_name)
although it's a bit strange to resort to doing this in python, what are you actually trying to achieve? Is this just a coursework question?
David answered the same question here arcpy-import-data-into-feature-dataset back in 2020.
In short, you just add the dataset name in the path when you copy it in.
arcpy.CopyFeatures_management(homes.shp, r'C:\new.gdb\Points\homes')
note, they must be the same spatial reference.