Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Make complex Finder selections with glob patterns Desktop
I wrote an AppleScript app called lselect that lets you select things in the Finder that match a glob pattern, such as what you would use to list particular files with the ls utility in Terminal. I find it useful when I want to quickly select a large group of files with similar but not identical names that aren't necessarily listed consecutively with any sorted Finder list views. Unlike the Find command, the selected results appear alongside the files that didn't match, making it easy to drag the selection to an application or folder in the same directory.

More information about the script (including how to use it) is available from the above link, and you can also view/use the raw source of the script.

[robg adds: I tested this one, and it works as described...]
    •    
  • Currently 2.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[13,528 views]  

Make complex Finder selections with glob patterns | 8 comments | Create New Account
Click here to return to the 'Make complex Finder selections with glob patterns' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Great!
Authored by: ecco on Nov 08, '06 10:45:06AM

You can place the compiled script in the Finder window toolbar. Only one click away if you need it.



[ Reply to This | # ]
Make complex Finder selections with glob patterns
Authored by: lar3ry on Nov 08, '06 11:14:38AM

One minor nit: In addition to the "-d" option to the ls command, it would be a good idea to add "-1" (that's number one with a hyphen in front of it). That ensures that the ls command lists a single item on each line.



[ Reply to This | # ]
Make complex Finder selections with glob patterns
Authored by: fredrikw on Nov 08, '06 11:59:21AM
There's no need for the -1, the man page for ls states:
-1 (The numeric digit ``one''.) Force output to be one entry per line. This is the default when output is not to a terminal.


[ Reply to This | # ]
choice of ls arguments
Authored by: anoved on Nov 08, '06 06:41:42PM

Exactly. In fact, my first draft of the script did use -1, but after reviewing the ls man page I saw the same note cited by fredrikw and decided to omit it for the sake of simplicity (since output to "do shell script" is not to a terminal).

On the other hand, it wouldn't hurt to retain the explicit argument, and it would clarify the intent of the code, so I may include it in any future revisions. In the meantime please do make (and share) any changes you find useful. Thanks!



[ Reply to This | # ]
Great tip!
Authored by: lotek on Nov 08, '06 01:04:07PM

Really useful -- thx for sharing.

---
Speak in French when you can't think of the English for a thing, turn out your toes as you walk, and remember who you are.



[ Reply to This | # ]
Make complex Finder selections with glob patterns
Authored by: elmimmo on Dec 17, '06 05:38:05PM

This should come with the OS.

BTW, the behaviour is funky when in column view.



[ Reply to This | # ]
lselect update for column view compatibility
Authored by: anoved on Dec 18, '06 09:39:49PM
This should come with the OS.

I'm glad you find it useful!

BTW, the behaviour is funky when in column view.

You're right, it is. I must not use column view too often because I hadn't noticed that before. Finder selections appear to work a little differently in column view.

So, I've made a few changes in an attempt to accommodate column view and dubbed it lselect 1.1 (same location as the original hint). It should behave more sensibly in column view (no new windows popping up), but there is one stumper bug: if the last item in lselect's internal list of matches is a directory, its contents column will be revealed and other matches will lose selection.

The original version remains available just in case this update causes any other problems.



[ Reply to This | # ]
Make complex Finder selections with glob patterns
Authored by: aqsalter on Mar 13, '08 03:37:17AM
I found that this script did not work for me on Leopard if the file selected was not a folder... i got an error "Can't make alias "Powerbook:Users:xxxx:my_file.txt" into type folder."
in order to fix it I changed the following lines:
if not (exists folder pwdAlias) then
	set pwdAlias to (container of pwdAlias) as alias
end if
to:
-- this should work, but doesn't
--set {isFolder, fName} to {folder, name} of (info for pwdAlias)
-- hack
try
	get folder pwdAlias
	set isFolder to true
on error
	set isFolder to false
end try
if not (isFolder) then
	set pwdAlias to (container of pwdAlias) as alias
end if

Hope that helps somebody.


[ Reply to This | # ]