Hi,
I have a string (full path): website/folder1/folder1/myimage.jpg (String!)
I want to extract the filename "myimage.jpg"
furthermore I need the fileextension "jpg"
thanks for any suggestions and links
Chris
What is the best way to get the filename of full path
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: What is the best way to get the filename of full path
Hi Chris,
"the itemdelimiter" (or short "itemdel") is your friend
Use it like this:
...
put "website/folder1/folder1/myimage.jpg" into tFullPath
## Filename:
set itemdel to "/"
put item -1 of tFullPath into tFileName
## -> myimage.jpg
## Suffix:
set itemdel to "."
put item -1 of tFileName into tSuffix
## -> jpg
...
Check the dictionary for more info about "itemdelimiter"!
Best
Klaus
"the itemdelimiter" (or short "itemdel") is your friend

Use it like this:
...
put "website/folder1/folder1/myimage.jpg" into tFullPath
## Filename:
set itemdel to "/"
put item -1 of tFullPath into tFileName
## -> myimage.jpg
## Suffix:
set itemdel to "."
put item -1 of tFileName into tSuffix
## -> jpg
...
Check the dictionary for more info about "itemdelimiter"!
Best
Klaus