Batch renamer

Hi all,
I am looking for simillar script to this one

this one is not available any more:(

I would like to do some batch rename:
- script checks if there is a bitmap texture assigned to "diffuse", "specular", "opacity" and
- renames the textures asigned using the pattern "NameOfTheObject_NameOfSlot.*"

- renames bitmap node same as texure name without extension ex. sample_difuse.jpg ---> bitmap slot sample_diffuse

I hope i explained it correct.

Thanks for help


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
asymptote's picture

Using Object Name not Material Name.

I just tried this in Max 2016, it renames the "on disk" texture files to the object name not the material name.

Is it supposed to do this or an I doing something wrong?

I desperately need a batch script that renames the on disk texture files to the material name in the material editor and updates the paths.

Can anyone help?


arch3d's picture


Thank you very much!!!

pixamoon's picture


oki, here it is, I add there make unique names because there might be for eg multiple diffuse maps in for one object (MultiSubMateiral or blend etc)

But be very careful with using it - it changes files on HDD. That's why I would recommend to use method - COPY files only to new location

method = #copy  
-- I recomend to COPY files to new location with new names
-- but if you realy want to rename
-- than change method to #rename
NewFolder = "C:\\NewFolderLocation\\"
if not doesFileExist NewFolder do makedir NewFolder
UniqueMatArr = #()
UniqueBitmapTArr = #()
fn FnFindMaps m objName = 
	if m !=undefined then 
		for i = 1 to getNumSubTexmaps m do (
			if (tm = getSubTexmap m i) != undefined do 
				if classof tm == BitmapTexture and finditem UniqueBitmapTArr tm == 0 then 
					append UniqueBitmapTArr tm
					if doesFileExist tm.filename do (
						newBitmapName = uniquename (objName + "_" + getSubTexmapSlotName m i + "_") =  newBitmapName
						case method of (
							#copy : (
								newFileName = NewFolder + "\\" + newBitmapName + getfilenametype tm.filename
								copyfile tm.filename newFileName
								tm.filename = newFileName
							#rename : (
								newFileName = getfilenamepath tm.filename + "\\" + newBitmapName + getfilenametype tm.filename
								renamefile tm.filename newFileName
								tm.filename = newFileName
			FnFindMaps (getSubTexmap m i) objName
fn FnFindMaterials m objName = 
	if m != undefined and findItem UniqueMatArr m == 0 do 
		append UniqueMatArr m
		if Superclassof m == Material then 
			for i = 1 to getNumSubMtls m do (
				FnFindMaterials (getSubMtl m i) objName
		FnFindMaps m objName
for o in objects do FnFindMaterials o.material


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.