Sequence Rename
small python Sequence Rename
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import os import re def readSequence(seqDir): getAllfileList = os.listdir(seqDir) for eachFile in getAllfileList: reExp = re.compile('[0-9]+') #print os.path.splitext(eachFile) getFileNumcnt = reExp.search(eachFile).group() newIntValue = '%04d'%int(getFileNumcnt) newFileName = '%s/%s.%s%s'%(seqDir,os.path.splitext(eachFile)[0].split('_')[0],newIntValue,os.path.splitext(eachFile)[-1]) oldFileName = '%s/%s'%(seqDir,eachFile) print oldFileName,newFileName os.rename(oldFileName,newFileName) readSequence('/home/******/***/hrender') |