View Full Version : Get path of a file and filename

02 February 2008, 04:28 AM
I want to get path location of file to a variable, I know file -location parameter but It cant give the exact path but also the file name :

A second question, how I get the file name in to a variable.

Thanks for your help, I am really noob in mel

02 February 2008, 03:10 AM

is this what you are after ?

string $filePath = `file -q -sceneName`; // get the current scene's full path
string $fileName = basename ($filePath,".ma"); // get the file name
string $dirname = dirname( $filePath );// get the directory of the current scene


02 February 2008, 10:14 AM
Great help, thanks alot :thumbsup:

03 March 2008, 09:48 AM
Hi, also basenameEx( $filePath ) will give you the scene name without the directory or the file extension.

CGTalk Moderation
03 March 2008, 09:48 AM
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.