Re: remove suffix
Re: remove suffix
- Subject: Re: remove suffix
- From: Nigel Garvey <email@hidden>
- Date: Thu, 27 Sep 2001 23:35:57 +0100
Paul Berkowitz wrote on Thu, 27 Sep 2001 01:07:39 -0700:
>
On 9/27/01 12:31 AM, "email@hidden" <email@hidden>
>
wrote:
>
>
> Hi,
>
>
>
> I have a script that copies htm files and adds some code in them. I need
>
to
>
> add some code to this script that removes the old suffix on each file.
>
>
>
> example:
>
> Filename = myfile.htm
>
> New filename = myfile
>
>
>
> This is probably very easy to do but I dont know how to write the
>
> applescript code to remove ".htm" of the filename. Today I use
>
> filemanipulator to do this, but it is one extra step. So it would be great
>
> to have this function in the script.
>
>
>
> Thanks in advance!
>
> Peter
>
>
set filename to text 1 thru -5 of filename
If you want it to work with "myfile.html" too, or with any other ".htm"
variant, use:
set filename to text 1 thru word -2 of filename
This will work with any suffixed file name where the suffix is a single
"word" and where the characters either side of the dot are not both
numeric digits.
NG