Make Complex Finder Selections

lselect is an AppleScript
that lets you select files in the Finder
using shell glob syntax as you would to list files with
ls.
Demonstration
- Screencast (2.5 MB Flash animation)
Download
See my comments in the script for more information about how it works and how it could stand to be improved. Other comments and discussion at Mac OS X Hints.
- lselect.scpt.zip 1.1 (24k) “Compiled” version
- lselect-toolbar-app.zip 1.1 (15k) Thanks to Henrik Nyh!
- lselect.applescript 1.1 (5k) Source
Changes
Version 1.1 improves compatibility with the Finder’s column view. One known remaining issue with column view is that if the last item in the list of matches is a directory, its contents will be revealed and other matches will lose selection. This may be a Finder bug.
Installation
Suggested installation location: ~/Library/Scripts/Applications/Finder/
The script can be invoked with the standard Mac OS X Script Menu, but I've found FastScripts to be a preferable alternative, primarily because of the ease with which reliable keyboard bindings can be assigned. I use ⌘G.
Usage
Actual usage scenarios exist, but if you have to ask what they are, this isn’t the tool for you.
Enter a glob pattern in the indicated field. This pattern will be compared against filenames in the current directory, and any complete matches will be selected. Briefly:
?- Match any one character.
*- Match any sequence of zero or more characters.
[abc]- Match any one character in
abc. A range of characters may be specified asa-z, or0-9, for example. [^abc]- Match any one character not in
abc. {a,b,c}- Matches any of the strings
a,b, orc, which may consist of more than one character each.
Spaces and certain other punctuation must be escaped with a backslash.
For example, a folder called “Jim's Stuff” would be matched by the pattern
“Jim\'s\ Stuff”. This requirement is not ideal. Please fix it!
Click Select Matches to select only those files that match the search pattern. If no files match, nothing will be selected. Click Add Matches to add any matches to the current selection. If Cancel is clicked the current selection will not be modified.
Similar Scripts & Utilities
- Daniel Jalkut’s excellent “Select Regular Expression” script.
- “A Better Finder Select” (shareware)
- Screen Sieve (doesn’t actually select matches or accept glob patterns, but it performs a relevant highlighting function system-wide)