If you know about cmds.file() and cmds.rename() then you are pretty much there already. The rest is just string formatting.
import os
cam = 'Shot_Cam'
start = 100
end = 143
sn = cmds.file(query=True, sn=True, shortName=True)
fname = os.path.basename(sn)
name = os.path.splitext(fname)[0]
new_name = '{}_{}_{}'.format(name, start, end)
cmds.rename(cam, new_name)
If you start with using the shortName option, you can avoid the extra step of needing to get the basename of the file. Then you use the os module to split off the extension. Format your extra criteria and then call rename()
Thanks.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/02190c7e-99f2-4edc-b260-d96d45524de5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.