I have seen similar questions but no clear answer and I am afraid that this can't be done in ModelBuilder alone.

Is there a way to truncate the extension off the %name% variable? I am working with .tif and .asc files that I use to resample and do zonal statistics but since they have file extensions the tools throw an error when using %name% and I am forced to use %n% and then rename the files using R. I have tried "%name%"[x:y] as suggested in another question but doesn't work.

Any suggestions? This is ArcMap 10.2 but had the same problem in 10.0

2 Answers 2


You could also use "%Name%".replace(".tif","") in Calculate Value in ModelBuilder.

  • I have same problem. I've alot of tiff files and I want to calculate zonal statistics on polygons in my Shapefile. I am using Arcmap 10.1 how can I use your suggestion please? Jan 6, 2022 at 18:08

You should be able to do this using the Parse Path (ModelBuilder) tool which may have been new at ArcGIS 10.1:

The Parse Path tool parses the input into its file, path, name, or extension. The output can be used as in-line variables in the output name of other tools.

  • thanks so much for this! I should have asked earlier and saved a ton of time coding this in R! Dec 18, 2013 at 3:54
  • ok I shouldn't have been so exited so quickly. I am having a problem now that the parsing happens before the iteration moves to the next raster. So result2 has the raster1 name. Dec 18, 2013 at 4:21
  • If you think this is part of the same initial Question would you be able to edit that to include more details and a diagram of your model, please? If you think it has moved to a new issue then perhaps research/ask it separately.
    – PolyGeo
    Dec 18, 2013 at 4:52

Your Answer

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

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