Parsing A File Path

Ian Wood revlist at azurevision.co.uk
Wed Feb 21 10:19:58 EST 2007


Try something like:

set the itemdelimiter to "/"
put last item of tFullPath into tFilename
put tFullPath into tPath
replace tFilename with "" in tPath -- path without the name
set the itemdelimiter to "."
put item 1 of tFilename into tName -- file name without extension
put last item of tFilename into tExt -- file extension

Note that this will fail badly if people are putting multiple periods  
into the file name, but it should be a start.

Ian

On 21 Feb 2007, at 14:27, Len Morgan wrote:

> I KNOW I've seen this somewhere but I can't seem to find it so I'm  
> hoping someone can point me in the right direction.
>
> I want to take a file pathname as returned from an "ask file"  
> command for example, and break it into  it's component parts.  I  
> thought there was a command that was passed a pathname and then it  
> returned a list of items (1 is drive/volume, 2 is path, 3 is  
> filename, 4 is extension, etc).
>
> I don't need someone to do this for me, just point me to where I  
> need to go look it up.
>
> Thanks a lot!
>
> Len Morgan
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list