PDA

View Full Version : Files Rename


rajeevalagh
07-21-2008, 03:42 PM
HI

Anyone know about how group of file rename like this with the help of command prompt or any other way:-


file name

rQ_epo102_sc20_file001
rQ_epo102_sc20_file001
rQ_epo102_sc20_file013

-----------

Rename file

RQ_epi102_sc21_file001
RQ_epi102_sc21_file002
RQ_epi102_sc21_file003

---------
thanks

misterdi
07-21-2008, 04:32 PM
Easiest way, get a free renaming tools such as LupasRenamer.

Scripting, if you have python you could use it as command line extension to do simple renaming such that. Use re module in python and just use re sub method to replace the pattern.

import re

for file in files:
newname = file
newname = re.sub("rQ", "RQ", newname)
newname = re.sub("epo", "epi", newname)
newname = re.sub("sc20", "sc21", newname)

Then you can rename the file with newname

NaughtyNathan
07-21-2008, 04:34 PM
are you talking about files on your hard drive? or file nodes in Maya..?

for nodes: select your file nodes, and use the rename input box (top right of the Maya UI) putting in the first name (e.g. RQ_epi102_sc21_file001). Maya should rename the remaining selection incrementally from this point.

(to access the rename input box simply click on the X: Y: Z: icon and switch it to rename)

:nathaN

rajeevalagh
07-22-2008, 04:11 PM
Easiest way, get a free renaming tools such as LupasRenamer.

Scripting, if you have python you could use it as command line extension to do simple renaming such that. Use re module in python and just use re sub method to replace the pattern.

import re

for file in files:
newname = file
newname = re.sub("rQ", "RQ", newname)
newname = re.sub("epo", "epi", newname)
newname = re.sub("sc20", "sc21", newname)

Then you can rename the file with newname
---------------------------------------------------------------------
hi

Thanks for response but i want rename lots of file in a folder exp:- when i finshed the rendering in avi or we create playblast of many differ scene but some scene have wrong name then i want to rename the file in this way:-

WRONG FILE NAME

rQ_epo102_sc20_file001 .avi
rQ_epo102_sc20_file003 .avi
rQ_epo102_sc20_file005 .avi

---------
RIGHT FILE NAME
RQ_epo101_sc21_file001 .avi
RQ_epo101_sc21_file002 .avi
RQ_epo101_sc21_file003 .avi

--------
how can we possible with scripting without any pulgin

regard

scottiedoo
07-22-2008, 09:35 PM
In MEL look in the command documentation for "sysFile" there is a rename flag that will do what I think you are after.

misterdi
07-23-2008, 02:52 PM
Unless there is a pattern to the change, it will be difficult to scripted the rename.
In your case, it will be easy to rename "rQ" to "RQ", also it is easy to change "sc20" to "sc21", but for the file you need to define a pattern, for example you could sort the files, and rename each one consecutively according to index of a list.

You could run the python snippet from Script Editor I believe,
as my examples files is a list of filename, you could easily get this with os.listdir or os.walk in python.
you could use sort to sort the list in ascending order.

Are you familiar with python?

rajeevalagh
07-23-2008, 03:41 PM
hi misterdi

No I am not familiar with python but i know little you give me script last time but how can i call file folder in script editer actullay i want this file rename with the help of command promt. so u know about command promt script

wait for response

CGTalk Moderation
07-23-2008, 03:41 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.