Message 1 of 2

Not applicable
07-06-2018
06:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This should be a no brainer, however I'm having problems renaming a series of OBJ files as they get imported
import maya.cmds as cmds import os myFolder = r"D:\temp\objs" fileType = "OBJ" objFiles = cmds.getFileList(folder = myFolder, filespec = "*.%s" % fileType) for item in objFiles: fname = os.path.join(myFolder, item) objname, ext = os.path.splitext(os.path.basename(fname)) # import each file cmds.file(fname, i = True) # rename it # cmds.rename(objName) # doesn't work
The reference to the import (item) is the pathname, and not the name it gives it in Maya (Group53873, Group1440, Group1393 etc) I want to rename them to the name of the OBJ (without extension) as decalred by objName.
I have managed to get around it (you don't wanna know) but I'd like to know what I'm doing wrong 🙂 confused
Solved! Go to Solution.