You can try this Python script:import osimport arcpyfrom arcpy import env# directory containing rasters to be renamedRASTER_DIR = 'C:/MyRasters/'env.workspace = RASTER_DIRfor raster in arcpy.ListRasters(): # get the raster name and file extension fileName,fileExtension = os.path.splitext(raster) # do some shenanigans to rename the file # based on your sample raster name, fileNameParts would look like # fileNameParts[0] = m # fileNameParts[1] = 3609922 # fileNameParts[2] = nw # fileNameParts[3] = 14 # fileNameParts[4] = 1 # fileNameParts[5] = 20100425 fileNameParts = fileName.split('_') compactFileName = fileNameParts[1] + fileNameParts[2] + fileExtension arcpy.Rename_management(raster,compactFileName)
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.