I'm trying to write a script and as I want to automate it as much as possible.
Is it possible to set the workspace as a variable so that when it is run as a standalone script, or as a tool in ArcToolbox, that it will allow everything else to run?
Below, for example, I want the user to select a workspace and then for the script to pick up the shapefiles from this workspace and also create the new geodatabase there.
# Create file Geodatabase
# Import ArcGIS modules
import arcpy
print arcpy.ProductInfo()
# Check out the ArcGIS Spatial Analyst Extension
arcpy.CheckOutExtension("spatial")
# Need to be able to OverWrite Outputs
arcpy.env.overwriteOutput = True
# Set workspace
arcpy.env.workspace = "C:/Prog_Data"
# Set up variables
out_folder_path = "C:/Prog_Data"
out_name = "Prog.gdb"
# Execute CreateFileGDB
arcpy.CreateFileGDB_management(out_folder_path, out_name)
# Set local variables before importing shapefiles to Geodatabase
inFeatures = ["Points.shp", "Extent.shp", "Rivers.shp", "Population.shp"]
outLocation = "Prog.gdb"
# Execute shapefile to Geodatabase
arcpy.FeatureClassToGeodatabase_conversion(inFeatures, outLocation)