Re: Back and forth between Posix and HFS paths
Re: Back and forth between Posix and HFS paths
- Subject: Re: Back and forth between Posix and HFS paths
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 26 Mar 2010 13:05:50 -0400
You could try this:
set itemList to {}
repeat with posixPath in paragraphs of (do shell script "ls -1td " &
(quoted form of POSIX path of containingFolder) & "/*" )
set end of itemList to POSIX file posixPath
end repeat
That will get you a list of actual AppleScript file objects, sorted by
modification date, that you can then do whatever you want with.
Change the "ls -1td" to "ls -1tdr" if you want them sorted in the other order.
On Fri, Mar 26, 2010 at 12:20 PM, Alex Zavatone <email@hidden> wrote:
> Wow. How remarkably non intuitive.
> In any case, that rocks Mark. I have to account for users putting funny file names into their folders.
>
> The deal is that the lovely approach of getting the sorted directory listing that I asked about yesterday takes 15 seconds for a directory of 174 items on a Quad Intel box under 10.6.whatever, while doing it from Unix is rather instant.
>
> Also, we have some boxes running 10.4 server and 10.5 and sadly, the Finder's sort does not work on 10.4.
>
> In any case, I'll post the Unix result if I get it working.
>
> Thanks again man
>
> Cheers,
> - Alex
>
> On Mar 26, 2010, at 10:47 AM, Mark J. Reed wrote:
>
>> POSIX file "unix path goes here" as string
>>
>> There are no non-UNIX-friendly characters in that filename, by the
>> way. The only character you can't have in a UNIX filename is a slash.
>> Your filename isn't particularly typing-at-the-command-line-friendly
>> (since it's hard to type a ™ and you have to quote the thing), but
>> really, there's no problem in UNIX with such files.
>>
>
>
--
Mark J. Reed <email@hidden>
_______________________________________________
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