• 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: Simple newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Simple newbie question
      • From: Philip Aker <email@hidden>
References: 
 >Simple newbie question (From: Peter Robertson <email@hidden>)

  • Prev by Date: Re: Simple newbie question
  • Next by Date: Re: Simple newbie question
  • Previous by thread: Re: Simple newbie question
  • Next by thread: Re: Simple newbie question
  • Index(es):
    • Date
    • Thread