• 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: Can I Speed Up This Folder Browsing Script?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I Speed Up This Folder Browsing Script?


  • Subject: Re: Can I Speed Up This Folder Browsing Script?
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 10 Nov 2004 10:57:40 -0800

On Nov 10, 2004, at 5:56 AM, Doug McNutt wrote:

I have been frustrated that the UNIX ls command sorts files differently than Finder mostly because Finder treats multi-digit decimal numbers in a non-text way. XX2.jpeg sorts before XX10.jpeg with Finder but it sorts after when ls is used. Finder is particularly annoying when industry standard part numbers like "2N2907.pdf" are used in file names.

Details, please. What industry, and where is the ordering defined?

Is that also a Unicode thing? I understand that a Linux version of ls has a -f option to handle intelligent sorting of file names that include dotted version numbers but I haven't tried it. I have also tried to find the actual rules used by Finder with no success. Is a decimal point included in the numeric conversion? Does it honor negative numbers?

<http://www.google.com/search?q=Finder+sorting+rules+site:apple.com>, first hit:


"The Finder in Mac OS X takes advantage of some sanctioned ways for altering the default sorting behavior defined by the Unicode standard. In particular, the Finder supports the following sorting rules:

- Punctuation and symbols are significant for sorting.
- Digit sub-strings are sorted by numeric value rather than as characters.
- Case is insignificant."


The rule you're interested in is of course the second one: any string of digits is sorted as if it's a single unit; non-digits (including "-" and ".") break the string into multiple units. This means that negative numbers don't work (it assumes that the hyphen is a separator of some sort), and decimals only sort of work (think of it in terms of sorting IP numbers instead.) For example:

"2" < "10"  (because 2 < 10)
"1.2" < "1.10" < "1.20" (because {1, 2} < {1, 10} < {1, 20})

If you want the C explanation, see <http://developer.apple.com/qa/qa2004/qa1159.html>.


--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: This email sent to email@hidden
References: 
 >Re: Can I Speed Up This Folder Browsing Script? (From: Mr Tea <email@hidden>)
 >Re: Can I Speed Up This Folder Browsing Script? (From: Christopher Nebel <email@hidden>)
 >Re: Can I Speed Up This Folder Browsing Script? (From: Doug McNutt <email@hidden>)

  • Prev by Date: Re: Read a cell in Excel 2004
  • Next by Date: Re: Read a cell in Excel 2004
  • Previous by thread: Re: Can I Speed Up This Folder Browsing Script?
  • Next by thread: How do I set the window level to "on the desktop"?
  • Index(es):
    • Date
    • Thread