I have 3 Feature Classes in a gdb. I want to create a script tool to rename each Featureclass and get each newname as parameter so we just have to type the newname we want. The original name has to appear in the tool (see image below). Is there a way to have this for each featureclass?

enter image description here

This how it looks for one feature class when opening the tool, but I want each feature class to appear here as rename parameter.

Here is the script I'm trying to create but it might be impossible. Do you have any idea of how I could manage to do that?

# Import arcpy module
import arcpy, sys, string, os

# Set Geoprocessing environments
workspace=arcpy.env.workspace = "D:\\PATH to GDB"

# Script arguments
name1 = arcpy.GetParameterAsText(0)
name2 = arcpy.GetParameterAsText(1)
name3 = arcpy.GetParameterAsText(2)

# Local variables:

Data_type = "FeatureClass"

# Process: Rename


for fc in fcs:
    arcpy.Rename_management(fc, name1???, Data_type)
  • can you clarify your question, i don't understand the intent
    – NULL.Dude
    Aug 30, 2018 at 16:22
  • Are the feature classes in your database in the exact same order as the way you'd like the name variable to replace them?
    – AGH_TORN
    Aug 30, 2018 at 16:35
  • Yes, do you think I should create an index?
    – Calder
    Aug 30, 2018 at 16:46

1 Answer 1


If all of your feature classes are in the exact same order as the name variable in your script, in other words:

name1 = fc1
name2 = fc2
name3 = fc3

You could put your names in a list and zip through it.

name1 = arcpy.GetParameterAsText(0)
name2 = arcpy.GetParameterAsText(1)
name3 = arcpy.GetParameterAsText(2)
names = [name1, name2, name3]


for x, y in zip(fcs, names):
    arcpy.Rename_management(x, y)

The zip function serves basically to map the values to one another. So in this case, name1 = fc1, name2 = fc2, etc...

  • Thanks for your answer. I'm really new to python. So if I understood each name of the 3 featureclass should appear as a parameter to rename. The parameters don't automatically show in arccatalogue when I add the script. Do I have to add it myself with real names of each feature?
    – Calder
    Aug 30, 2018 at 17:09
  • So what arcpy.ListFeatureClasses() does is walk through a directory and put each feature class name inside a list. The feature classes themselves should not be parameters in your script. Like I said previously, as long as each name is in the same order as the feature classes in your gdb then my answer will work.
    – AGH_TORN
    Aug 30, 2018 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.