PDA

View Full Version : Query file short name


PozestStar
12-08-2011, 04:59 PM
Another week another question.

I was wondering how to get the short name of a file.

When I do:
string $fn = `file -q -sn`;

I get:
C:/Users/Pozest Star/Desktop/Bob.mb
I really just want Bob.mb (I want Bob, I need Bob :p)

If I have to tokenize, I will, but I thought there was an easier way to do this. Is there?

Thanks!

NaughtyNathan
12-08-2011, 05:04 PM
you can do it with a `match` command, but Alias already packaged it up for you with the basename and basenameEx commands:
basename $fn "";:nathaN

PozestStar
12-08-2011, 05:37 PM
:bowdown:I want to be like you when I grow up.

Thanks so much, that worked like a charm.

NaughtyNathan
12-08-2011, 07:57 PM
I want to be like you when I grow up.you'd need a hell of a lot of hormone therapy. :p

CGTalk Moderation
12-08-2011, 07:57 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.