PDA

View Full Version : rename file texture using mel?


jaydru
10-09-2008, 05:59 PM
anyone know if its possible to rename file texture using mel,
for instance say if i had a file on my computer called
tempA.tga and i wanted to chane it to tempB.tga,
is this possible using mel?
if so a point in the right direction would be greatly appreciated :)

just to be clear its not the file node i want to rename but the acctual texture

GiantG
10-09-2008, 08:04 PM
Use the system command like:

On Windows something like that
system("ren tempA.tga tempB.tga")

jaydru
10-09-2008, 11:15 PM
i'll give that a try, i sort of got something working by loading the textures in to the render view and then saving them out again, a bit clunky cuz it duplicates the texture but also cool cuz i dont have to worrie about files being write protected by alienbrain

NaughtyNathan
10-10-2008, 08:59 AM
while the system command is good as it allows you to do more than just rename files it can be a bit clunky to assemble command strings and it only works on Windows. For basic file handling it's far better to use the sysFile MEL command as it's OS independant and a lot nicer syntax. check it out in the MEL docs.

either that or use Python.. :)

:nathaN

Norb
10-10-2008, 06:10 PM
Here's how you can do it in Python...


import os

originalName = 'c:/tempA.tga'
newName = 'c:/tempB.tga'

os.rename(originalName, newName)

CGTalk Moderation
10-10-2008, 06:10 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.