Re: file references
Re: file references
- Subject: Re: file references
- From: Luther Fuller <email@hidden>
- Date: Thu, 15 Nov 2012 12:35:56 -0600
On Nov 15, 2012, at 12:13 PM, Jim Brandt wrote: For a "large" directory (220 files and folders), several folders deep, the Finder took 25 seconds to return this list while System Events only took < 1 second. If I then have to jump through hoops to use that reference though, I'll probably try a different way. (I'm leaning towards a Unix "ls" command).
Using 'ls' is a good way to lean. Using 'find' is also a good way to lean. I use a variation on the handler, below, to get an alias to every mail file in a mailbox (.mbox) folder no matter how deeply nested. (.mbox folders in Lion have a complicated structure.)
on getFileAliasList(folderAlias) set AppleScript's text item delimiters to {return} -- quoted form of (POSIX path of folderAlias) do shell script "find " & the result & " -name '*.emlx'" set fileList to (text items of the result) -- repeat with i from 1 to (count items of fileList) (POSIX file (item i of fileList)) as alias set item i of fileList to the result end repeat return fileList end getFileAliasList --------------------------------------
And this handler seems to be extremely fast in Lion. You will have to read the help for 'find' to understand how to get the files you want.
|
_______________________________________________
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