Re: Simple newbie question
Re: Simple newbie question
- Subject: Re: Simple newbie question
- From: Christopher Nebel <email@hidden>
- Date: Thu, 18 Jun 2009 11:14:02 -0700
On Jun 17, 2009, at 1:17 PM, Peter Robertson wrote:
How can I get just the name of a file without the extension? If I use
set theName to (text 1 thru ¬
(offset of "." in theFile) of theFile)
with say file '123.jpg' I get '123.' I want just 123 without the "."
Various people have shown different ways of munging the full name
string (though no one has suggested using basename(1) yet...), but to
elaborate on what Finder itself offers, there are three different
properties in Finder relating to the "name" of a file:
name: the name as it appears in the file system, always including the
extension.
displayed name: the name as it appears in Finder, taking the "hide
extension" settings into account.
name extension: just the extension, if any.
Bear in mind that Finder's idea of an "extension" is based on Launch
Services and what extensions have been registered by applications on
your system, not just whatever comes after the last dot in the name.
For example, if you ask what the "name extension" is of a file named
"foo.potrzebie", you'll get "".
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden