Re: Sortin an alias list by path
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