MEL Scripting - Moving up a directory


#1

Hey everyone! Been searching for several hours to figure out this extremely simple task so I figured I’d finally post. I’m unfamiliar with MEL (primarily learning Python). I am trying to move up several directories from the project root in a string. Our render folder is two folders above the maya project directory, so I’m looking to just path backwards, or omit the end of the string.

Where I’m at right now is:

string $path =workspace -q -fullName;

which returns: ....03_LookDev/work/maya/scenes

I want to change the string to path backwards to 03_LookDev and then go into a /renders/maya/name of file folder/

I imagine this is pretty straight forward but just can’t find any documentation on tweaking file paths, thanks so much.


#2
string $path =`workspace -q -fullName`;
// Result: 'D:/OneDrive/Prj_Studio6/3d_Studio6' //

$path = dirname($path);
// Result: D:/OneDrive/Prj_Studio6 //
$path = dirname($path);
// Result: D:/OneDrive //
$path+="/renders/theOtherFolder/";
// Result: D:/OneDrive/renders/theOtherFolder/ //