Dumb File Question

Ken Ray kray at sonsothunder.com
Sun Nov 12 23:06:43 EST 2006

On 11/12/06 9:51 PM, "Scott Kane" <scott at cdroo.com> wrote:

> Hi folks,
> Been away from programming a bit due to health issues (almost nine months).
> Anyway I've been trying to nut out how to get the file name from a complete
> path.  I know it should be a matter of using delminiting but I can't get it
> to work.
> For example this path:
> c:\MyDocuments\Images\myimage.jpg
> What I want to extract is just the file name "myimage.jpg".
> I've searched the doc's etc and seem to be going in circles.  Would really
> appreciate any solution you may have.

Hey, Scott! Welcome back!

First of all, remember that all paths inside Rev are forward-slash delimited
(/), not backslash-delimited, although the following suggestion will work
regardless (just substitute the proper slash):

  put "C:/My Documents/Images/myimage.jpg" into tPath
  set the itemDel to "/"
  put item -1 of tPath into tFileName

--> tFileName now contains "myimage.jpg"


Ken Ray
Sons of Thunder Software, Inc.
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com

More information about the Use-livecode mailing list