Tell Finder, sort by name in reverse order

tell application "Finder" to set listOfFiles to sort listOfFiles by name

I’ve searched everywhere to no avail. How do I sort this list of Finder items in descending order by name?

Many thanks.

Perhaps something like

tell application "Finder"
	
	set myFiles to choose file with multiple selections allowed
	
	my SortList(myFiles)
	
end tell

on SortList(aList)
	set leftList to {}
	set rightList to {}
	set pivot to item 1 of aList
	
	if (count of aList) > 1 then
		tell application "Finder"
			repeat with i from 2 to count of aList
				set oneItem to item i of aList
				if name of oneItem > name of pivot then
					copy oneItem to the end of leftList
				else
					copy oneItem to the end of rightList
				end if
			end repeat
		end tell
	end if
	
	set sortedList to {pivot}
	if (count of rightList) > 0 then
		set sortedList to sortedList & SortList(rightList)
	end if
	if (count of leftList) > 0 then
		set sortedList to SortList(leftList) & sortedList
	end if
	return sortedList
end SortList

A part of me was hoping there would be a two word addendum to my script, but I guess it doesn’t come that easy :wink:

Thanks Mike!

Hi,

simple solution


set myFiles to reverse of (choose file with multiple selections allowed)