PDA

View Full Version : folder and file operations


kiryha
11-30-2012, 09:57 AM
1)
file -q -sn;
return full path with file name, how to get only name of maya file?

2) How to get folder name in wich file is located?
If i have scenes/models/myFile.mm i need "models" string.

3) How to cut parts of strings?
If i have "models" string and i need to leave only first 3 elements("mod")

djx
11-30-2012, 12:19 PM
mel has "basename" and "dirname", so you could use them. If you want to have more control you can use "tokenize" to split the string into an array using "/' as the split character.

Consider using python though which has Folder and File operations too many to mention, and too useful not to.

David

bolekcg
12-02-2012, 05:53 PM
Welcome guys.

Also workspace -q -dir or pwd could be useful.
Best!

CGTalk Moderation
12-02-2012, 05:53 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.