Removing duplicate textures from a large number of max files

Hello. sorry for my English. maybe someone saw a script that allows you to unite many identical textures but with different names and located in different max files and delet duplicate files.