• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Extract Folder Name from Full Path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Extract Folder Name from Full Path (From: Marconi <email@hidden>)

  • Prev by Date: Re: Extract Folder Name from Full Path
  • Next by Date: Re: applescript-users digest, Vol 3 #1930 - 17 msgs
  • Previous by thread: Re: Extract Folder Name from Full Path
  • Next by thread: Re: Extract Folder Name from Full Path
  • Index(es):
    • Date
    • Thread