Re: What is the best way to get the name (without the extension) of a file?
Re: What is the best way to get the name (without the extension) of a file?
- Subject: Re: What is the best way to get the name (without the extension) of a file?
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 4 May 2005 22:50:16 -0400
If you're going to go outside of AppleScript to the shell, which is
already something less than efficient, there's no need in this case to
then turn around and have the shell run sed (or cut or awk
or whatever your favorite tool is for this); you can just use the shell
affix-removal syntax:
set fullName to "com.apple.iTunes.eq.plist"
set baseName to do shell script "filename=" & quoted form of fullName & "; echo ${filename##*.}"
But this sort of string manipulation is probably best done within
AppleScript itself. There are things that AS is so slow at doing
that the extra overhead of running the shell and then a program from
the shell is worth it, but I don't think stripping the extension off a
filename is one of those things. :)
On 5/4/05, Gnarlodious <email@hidden> wrote:
How about this one:
set fileName to "com.apple.iTunes.eq.plist"
do shell script "echo " & quoted form of the fileName & "| sed 's|\\(.*\\)\\..*$|\\1|' "
-- Gnarlie
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (
--
Mark J. Reed <
email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden