PDA

View Full Version : Get path of a file and filename


ghostlake114
02-27-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

ashishdantu
02-28-2008, 03:10 AM
hi,

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


:thumbsup:

ghostlake114
02-28-2008, 10:14 AM
Great help, thanks alot :thumbsup:

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

CGTalk Moderation
03-02-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.