Re: Slow Command in Snow Leopard
Re: Slow Command in Snow Leopard
- Subject: Re: Slow Command in Snow Leopard
- From: "Mark J. Reed" <email@hidden>
- Date: Sun, 7 Mar 2010 19:45:36 -0500
On Sun, Mar 7, 2010 at 7:23 PM, Luther Fuller <email@hidden> wrote:
> do shell script "ls -1dp " & the result & prefIdent & "*"
> on error
> return {}
> end try
> set pathList to text items of the result
You don't want "text items of", unless you first set tids to linefeed.
The "-1" option to ls tells it to put each filename on a separate
line, and I included it so that "paragraphs of" will yield the correct
list. If you just use "text items of" with default delimiters you'll
get filenames split up if they have spaces in them.
> The "*" probably tells 'ls' to find names beginning.
> What is the "/" for?
If the directory name is something like
"/Users/foo/Library/Preferences", and you want to find widget-com.*,
then just putting the strings together will look for
"/Users/foo/Library/Preferenceswidget-com.*", which won't exist.
> (I was sure I would find the answer when I removed it, but it worked
> anyway.)
It so happens that "POSIX path of" a directory appends a "/" on the
end, so you don't need an extra one in this case, but when putting
together POSIX path strings it's a good habit to get into, since extra
slashes in the middle of a pathname don't do any harm.
> And more importantly ...
> Why can't Snow Leopard do this?
It can and does.
> The fact that a 'do shell script ...' works indicates a bug here.
It's a performance problem in Finder, clearly. It has a completely
different implementation of filename matching.
--
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