find filename in a folder

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 04 April 2009   #1
find filename in a folder

Hey Guys,

my script finds max files in a set directory named like the current selection:

files = getFiles (trydir+$.name+"*.max")


gives this output: #("Z:\BWS\max\G11.max")

i want to get just the filename, i.e. "G11.max"

Any ideas how I can do this?
 
Old 04 April 2009   #2
Hi leigh, check out the topic File Name parsing in the maxscript help. you will find a function called getfilenamefile <file string> that you can use to do this.

if you also check the external file methods topic you will find a recursive search function for finding files in nested folders, which might help you with your other post.
__________________
Regards,
Pete

Read my technical blog - lonerobot.net
 
Old 04 April 2009   #3
Have you tried this:

files = (getFiles (trydir+$.name+"*.max"))[1]


Cheers.
__________________
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
http://www.ycdivfx.com
 
Old 04 April 2009   #4
that gives "Z:\BWS\max\G11.max", thanks anyway.

will try lonerobot's suggestion now
 
Old 04 April 2009   #5
I stand corrected....

files = filenameFromPath (getFiles (trydir+$.name+"*.max"))[1]
__________________
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
http://www.ycdivfx.com
 
Old 04 April 2009   #6
Works like a charm, thanks dude!
 
Old 04 April 2009   #7
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:56 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.