• 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: Sort error in Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sort error in Leopard


  • Subject: Re: Sort error in Leopard
  • From: Christopher Stone <email@hidden>
  • Date: Wed, 08 Feb 2012 19:46:01 -0600

On Feb 08, 2012, at 03:54, Nigel Garvey wrote:
Back in the days before 'sort' disappeared with the introduction of Mac OS X, it would take a Finder reference as its direct parameter. When it was reintroduced (with Tiger, I think), it only accepted lists, so references had to be realised first.
______________________________________________________________________

Hey Nigel,

Thanks.  That rings true, although my memory is admittedly foggy.

Using the Finder to do the sort is rather grossly slow - 3 full seconds to sort 55 items on my i7 MacBook Pro with Lion.

By contrast this will run in ~ 0.05 seconds on the same folder:

on listFolderByModDate(folderAlias)
set posixFolder to POSIX path of folderAlias
set posixFolderQuoted to quoted form of posixFolder
set itemList to (do shell script "ls -tr " & posixFolderQuoted)
set itemList to paragraphs of itemList
return itemList
end listFolderByModDate
on makeAliasList(folderAlias, fileNameList)
set folderAlias to folderAlias as text
repeat with i in fileNameList
set contents of i to (folderAlias & contents of i)
end repeat
return fileNameList
end makeAliasList

set folderAlias to alias "Thor:Users:chris:Pictures:Downloads (New):"
set sortedFileNameList to listFolderByModDate(folderAlias)
makeAliasList(folderAlias, sortedFileNameList)

I *think* it will work back to Tiger for a mod-date sort and perhaps further.

--
Best Regards,
Chris

 _______________________________________________
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: Sort error in Leopard
      • From: Shane Stanley <email@hidden>
References: 
 >Re: Sort error in Leopard (From: Nigel Garvey <email@hidden>)

  • Prev by Date: Re: Finder & Invisibles
  • Next by Date: Re: Issue with process names
  • Previous by thread: Re: Sort error in Leopard
  • Next by thread: Re: Sort error in Leopard
  • Index(es):
    • Date
    • Thread