Re: Extract Folder Name from Full Path
Re: Extract Folder Name from Full Path
- Subject: Re: Extract Folder Name from Full Path
- From: Andrew Oliver <email@hidden>
- Date: Sat, 16 Aug 2003 09:33:06 -0700
Unfortunately, the easiest way is to ask the Finder to do it for you:
tell application "Finder"
set theFolder to choose folder
set FolderName to name of theFolder
end tell
If you don't want to rely on the Finder, then text item delimiters are your
friend (watch the line breaks):
set theFolder to choose folder
set {oldTIDs, AppleScript's text item delimiters} to {AppleScript's text
item delimiters, ":"}
set theFolderName to text item -2 of (theFolder as string)
set AppleScript's text item delimiters to oldTIDs
Andrew
:)
On 8/16/03 9:09 AM, "Marconi" <email@hidden> wrote:
>
How can I extract just the folder name from a full path?
>
>
I'm using:
>
>
set FullPath to (choose folder) as string
>
>
which sets FullPath to something like:
>
"Mac HD:Users:Marconi:Mail Server Logs: 2003-07:"
>
>
and I want 'set FolderName...' to set Foldername to just the last
>
folder in the FullPath: "2003-07".
>
>
How do I extract just "2003-07" from "Mac HD:Users:Marconi:Mail
>
Server Logs: 2003-07:" ?
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.