I used your code for the same application. the code runs fine and won't give me any issues. However I can't find the new rasters. Is there any way we can save the new rasters in a different folder?
My files are like this
20190512_160716_104b_3B_AnalyticMS_SR_clip
20190512_160717_104b_3B_AnalyticMS_SR_clip
This is the code I used
import arcpy
import os
dir = r'D:\My_Canola_Project\1 New Process\Testing 5 Images'
arcpy.env.workspace = dir
for ras in arcpy.ListRasters("*_clip"):
print (ras)
basename = ras.split("_clip")[0]
newrastername = "I_" + basename
print (newrastername )
arcpy.Rename_management(ras, newrastername)
Thanks in Advance