Re: Extract Folder Name from Full Path
Re: Extract Folder Name from Full Path
- Subject: Re: Extract Folder Name from Full Path
- From: Deivy Petrescu <email@hidden>
- Date: Sun, 17 Aug 2003 21:49:27 -0400
On Saturday, Aug 16, 2003, at 12:09 US/Eastern, Marconi 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:" ?
Then Andrew wrote:
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):
...
Well, one does not need to put the choose folder command in the tell
"Finder" wrap, but the "If you don't want to rely on the Finder.." bit
got me thinking and I decided to try the same thing with system events.
If one runs:
set fullpath to (choose folder)
tell application "System Events" to get name of folder fullpath
nothing is returned! SE or Smile.
No errors, just no result. Same thing for other properties ( I checked
mod date).
If one changes "folder" to "item" the the Script throws an error
message NSsomething (the usual...)
This does not bother the "Finder" which accepts both "item" and
"folder" interchangeably.
Is this a bug? Has this been mentioned before?
Is this a feature?!?!
Thanks
Deivy
_______________________________________________
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.