[GIS] how to remove underscore from filename in directory using modelbuilder

arcgis-desktopbatchmodelbuilder

Does anyone have a script I can use in modelbuilder that will?:

  • parse an "_" from a filename

  • usable in modelbuilder with an inline variable (%name%) and Feature class iterator

  • transfer or copy the actual renamed shapefiles to another folder?

Any help or suggestions will be greatly appreciated.

enter image description here

Best Answer

Rather than writing a Python script tool you should be able to use a Calculate Value tool with the Python code recommended by @blah238:

r"%name%".replace("_","")

The next step will be to use the Rename tool to use the text string this creates to rename the feature class.