Maxscript change filename to pathfilename


I’m trying to make a script to change the name of the bitmap to the name of the bitmap folder… it has the function of unifying the same bitmaps organized in folders…

would have to collect all bitmaps, including all types, like coronabitmap, vraybitmap, etc…


the 3 Bitmap in =

the 3 Bitmap result =

I’m trying something like:
theMaps = getClassInstances BitmapTexture
for i in 1 to theMaps.count do (
theMaps[i].filename = (getFilenamePath theMaps[i]) + (getFilenameType theMaps[i])

but nothing happens