Re: Sort folder list descending
Re: Sort folder list descending
- Subject: Re: Sort folder list descending
- From: Luther Fuller <email@hidden>
- Date: Thu, 25 Mar 2010 17:44:11 -0500
On Mar 25, 2010, at 4:28 PM, Alex Zavatone wrote: On Mar 25, 2010, at 4:20 PM, Luther Fuller wrote: On Mar 25, 2010, at 4:10 PM, Alex Zavatone wrote: Ok, it looks like this is most of the way there. Do you have a good way to get the text name of the folder out of the resulting list while keeping the sort order?
How do I simply get the folder name of these folders as On Mar 25, 2010, at 3:33 PM, Luther Fuller wrote: get sort (get folders of sourceFolder) by modification date set folderList to (reverse of the result) as alias list
Perhaps this does what you are looking for ...
set sourceFolder to alias "OS_X:Library:Frameworks" -- for example tell application "Finder" get sort (get folders of sourceFolder) by modification date set folderList to (reverse of the result) as alias list -- repeat with i from 1 to (count items of folderList) (name of item i of folderList) as text display dialog the result end repeat end tell beep
Or not?
Yep. That does. I saw that I could get the name of an individual item of the list but for some reason you can not get the name of every item or each item in the list. I was hoping there was one of those elegant AppleScript one liners that lets you do a loop in one line.
Sometimes, it's pretty impossible to know when AppleScript will let you do do something and when it won't.
Thanks Luther. You saved me serious pain here.
AppleScript will let you do almost anything, but not necessarily as a one-liner. In this case, I tried a couple of things I thought might work as a one-liner, but no luck.I think you are stuck with something like this ...
on getSubFolders_oldestFirst(sourceFolder) tell application "Finder" get sort (get folders of sourceFolder) by modification date set folderList to (reverse of the result) as alias list -- repeat with i from 1 to (count items of folderList) (name of item i of folderList) as text set item i of folderList to the result end repeat end tell return folderList end getSubFolders_oldestFirst ---------------------------
The second half converts folderList from a list of aliases to a list of text names.
|
_______________________________________________
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