Page 1 of 1

How to Export Filename only (not full Path, no extension)

Posted: Mon May 17, 2004 12:08 pm
by tprothma
I've searched all of the forum topics, even downloaded the scripting help file, but can't figure out the syntax to output the filename (would actually prefer it without the extension)

For instance, I want to script to give me an column for the file named "c:\My Documents\Tweetie.mp3". itm.Path gives the full path and filename + extension. I want only the filename "Tweetie" and would prefer a separate one for file extension "mp3".

I have tried this for Excel:
WS.Cells(i+2,8).Value = itm.Path
WS.Cells(i+2,9).Value = itm.FileName

But it doesn't work.

Is there an itm.somthing that would work.
Alternatively might be able to parse itm.path backwards util I reach a \ in the string, but I'm not good at scripting.

Any help would be appreciated.


Posted: Tue May 18, 2004 9:13 am
by Lowlander
You could have the code delete the last 4 characters (extension only) or everything after the last /. The code I don't know either right now, but there are many examples available on the net.