maxscript: Rename texture files to fit 8 characters

Hi,

I was wondering if there was any script that automatically duplicate a texture file and rename it so that it matches the requierement for 3ds export:

8 letters...

and for those :

thisnameiswaytoolong_brown.jpg
thisnameiswaytoolong_grey.jpg

does not cut like :

thisname.jpg
thisname.jpg

but

thisna01.jpg
thisna02.jpg

I started developping it but if some already exist...

thanks