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

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: How to Export Filename only (not full Path, no extension)

by Lowlander » Tue May 18, 2004 9:13 am

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.

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

by tprothma » Mon May 17, 2004 12:08 pm

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.

Thanks,
Tim

Top