I am having all sorts of issues trying to get my stand alone script to be a script tool.
I am walking through all the folders, sub folder, gdb, dataset and feature classes. I am having problems with setting my parameter for feature class input in which it doesn't recognize operand and strings if I do the GetParameter() instead of GetParameterAsText(). GetParameterAsText will not let me iterate the multiple feature classes. This is what I have below.
import os, sys, arcpy
#Local Variable
ws = arcpy.env.workspace = arcpy.GetParameterAsText(0)
walk = arcpy.os.walk(ws)
arcpy.env.overwriteOutput = True
# User Input Variable
fcs = arcpy.GetParameter(1)
for thing in fcs:
arcpy.AddMessage(thing)
company = arcpy.GetParameterAsText(2)
outFolder = arcpy.GetParameterAsText(3)
SQL = arcpy.GetParameterAsText(4)
#Walks through the top folder down to each sub-folder listing all feature class
for dirpath, dirnames, filenames in walk:
for dirname in dirnames:
arcpy.env.workspace = os.path.join(dirpath, dirname) #Changes workspace enviroment to see each directory path/ directory name
#print arcpy.env.workspace
for ds in arcpy.ListDatasets('', feature_type="feature"):
for fc in arcpy.ListFeatureClasses('', '', ds):
for x in fcs:
outshape = x + "_" + company + "_" + time.strftime("%m%d%y") + "_" + ".shp"
outpath = os.path.join(outFolder, outshape)
if x in fc:
arcpy.Select_analysis(x, outpath, SQL)