I am very new to Python, and I'm trying to create a function where I'm copying over feature classes from a gdb to different folder locations as shapefiles. The script needs to be reading from a textfile that lists the different path locations. Here is a screenshot of the textfile:
So if the feature class from the gdb is "apd" it needs to copy over to "\DataSets\APD\apd.shp", if it's "comps", it needs to be copied over to "\DataSets\Completion\comps.shp", and so on. The function needs to have two parameters (the input and the output). The input being the feature class and the output being the destination path.
How do I define my destination parameter so that a particular feature class needs to be copied over to that specific folder?
Sadly, my code is looking something like this:
import arcpy import os arcpy.env.workspace = 'GOM3.gdb\\NAD1927' featureclasses = arcpy.ListFeatureClasses() def CopyFeature (fc, dest): for fc in featureclasses: if arcpy.Exists(fc): fname="X:\GOM-Cubed\DataSets\ShapefileList.txt" with open(fname) as f: content = f.readlines() for dest in content: arcpy.CopyFeatures_management(fc, dest) fname.close()
Eventually I want to add this script to ModelBuilder. That way the user can define the input parameter.