Programatically Create Feature Classes based on the name of the File Geodatabase

Discussion created by Playa on Oct 27, 2011
Latest reply on Oct 27, 2011 by jskinner-esristaff
Firstly I've just started learning to program so I know very little. I've generated the following python script to loop through a directory to select all the file geodatabases to add a new attribute domain based on a table that i've created in a geodatabase. I would like to modify the script to create a new feature class within each file geodatabase under the feature dataset where the name has a suffix based on the file geodatabase name. I've attached a print screen of the folder and database structure and name of an existing feature class that I would like to create for each additional file geodatabase based on its name i.e. "lu_G40H"

import arcpy, os
from arcpy import env

folder = r"S:\Projects\H107039\GIS\ModelBuilder\Geodatabases"

for (path, dirs, files) in os.walk(folder):
    if ".gdb" not in path.lower():
        env.workspace = path
        databases = arcpy.ListWorkspaces("*", "FileGDB")
        # Set parameters
        DomainTable = arcpy.GetParameterAsText(0)
        Code = 'Code'
        Description = 'Description'
        DomainName = arcpy.GetParameterAsText(1)
        DomainDesc = arcpy.GetParameterAsText(2)
        Replace = 'Replace'
        # Run Tool
        for database in databases:
            arcpy.TableToDomain_management(DomainTable, Code, Description, database,
                                           DomainName, DomainDesc, Replace)

Anyone that can offer me assistance to change the following script will really be appreciated.