• 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: Sortin an alias list by path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sortin an alias list by path


  • Subject: Re: Sortin an alias list by path
  • From: Stan Cleveland <email@hidden>
  • Date: Tue, 04 May 2010 15:41:28 -0700
  • Thread-topic: Sortin an alias list by path

Title: Re: Sortin an alias list by path
On 5/4/10 3:05 PM, "Jay Louvion" wrote:

Just a quick question, before I myself dive into a (possibly) long development;

When considering a list of aliases returned by “every file of entire contents of”, I have noticed that the list doesn’t seem to be returned according to the order of the paths, but (I believe) to the filename, alphabetically.

Has someone already developped a way of sorting this list out according to the path? (getting the list of files from folder “A” before the list from folder “B”, and ideally doing so whatever the depth of hierarchy.

I hope I am clear enough, but feel free to say if not, and I’ll try to be more specific.

Hi Jay,

My first thought is to convert all those file references into strings, then sort them, something like this:

set AppleScript's text item delimiters to return
tell
application "Finder"
    set fileList to paragraphs of (every file of entire contents of folder "Mac HD:Users:stanc:Sandboxes:" as text)
end tell
set
AppleScript's text item delimiters to ""
qsort(fileList, 1, count fileList)
return fileList

My suggestion for the qsort() handler is the one by Nigel Garvey and Randy Knapp, found here:
http://macscripter.net/viewtopic.php?id=17340

HTH,
Stan C.
 _______________________________________________
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: Sortin an alias list by path
      • From: Jay Louvion <email@hidden>
References: 
 >Sortin an alias list by path (From: Jay Louvion <email@hidden>)

  • Prev by Date: Sortin an alias list by path
  • Next by Date: Transmit 3 "on open" vs "choose file" problem
  • Previous by thread: Sortin an alias list by path
  • Next by thread: Re: Sortin an alias list by path
  • Index(es):
    • Date
    • Thread