Posts

Showing posts from June, 2021

Windows PowerShell: Rename files in a folder

Right click "Start" and select Windows PowerShell. In the PowerShell, use "cd" to move to the directory(folder). e.g. cd C:\Users\[User Login]\Documents\test\ to move to "test" folder in your Documents folder. To rename files in this current folder, use PowerShell command like below. Get-ChildItem "*.jpg" | Sort Name | % { $i = 1} { $Newname = "rename_image" + $i.ToString("000") + $_.extension; Rename-item $_ $Newname; $i++ } This renames all jpg files to "renamed_image###".jpg If there are three jpg files, the files will be renamed_image001.jpg renamed_image002.jpg renamed_image003.jpg  

HIK: Getting current character and current source.

class HIK:     def getCurrentCharacter(self):         import maya.cmds as mc;         currentCharacterLabel= False;         currentCharacterIndex= mc.optionMenuGrp("hikCharacterList",q=1,sl=1);         items= mc.optionMenuGrp("hikCharacterList",q=1,itemListLong=1);         currentCharacterItem= items[currentCharacterIndex-1];         currentCharacterLabel= mc.menuItem(currentCharacterItem,q=1,label=1);         if not mc.objExists(currentCharacterLabel): currentCharacterLabel= None;         elif mc.nodeType(currentCharacterLabel)!="HIKCharacterNode": currentCharacterLabel= None;         return(currentCharacterLabel);     def getCurrentSource(self):         import maya.cmds as mc;         currentSourceLabel= False;         currentSou...