I have a file geodatabase containing +200 rasters. I want to export a selection of these based on words in the middle of the file name. Example file names below:







How do I select only the files containing "day" to export to another filegeodatabase? I would like to do this in model builder using an iterator if possible.

  • 1
    Would be easy using arcpy. I can post an arcpy answer if you are ok with this – BERA Mar 20 '19 at 14:25
  • yes please, I can give that a go. – FRMMO Mar 20 '19 at 14:27

You can use arcpy. List the rasters using ListRasters and copy to new fgdb. Change input and output databases and execute in python window:

import arcpy, os

input_fgdb = r'C:\Somedatabase.gdb'
output_fgdb = r'C:\Someoutputdatabase.gdb'

arcpy.env.workspace = input_fgdb
rasterlist = [r for r in arcpy.ListRasters() if 'day' in r]

for r in rasterlist:
    arcpy.CopyRaster_management(in_raster=r, out_rasterdataset=os.path.join(output_fgdb,r))

(This will copy all rasters with "day" in the name, regardless of the position of "day" in the raster name)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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