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

10.4: More convenient filename searches System 10.4
Leopard will have a better file name search capability, but while we wait, searching for file names with wildcards and boolean AND/ORs can be fairly convenient with this hint. First, some setup. Go to your home folder and choose FIle » New Smart Folder from the menu. Click on the minus signs to remove all the search terms, and then click on the plus sign to add one. Click on Kind and choose "Other...". After a short delay, a list will appear. Scroll down and select Raw Query, then press OK. Now copy and paste the following lines (including the blank lines) into the query text box:

(i==' Scroll forward and replace "xxx" with filename, use "||" for OR,  "&&" for AND, "*" for wildcard, "cwd" for case insensitive/any word ')||((kMDItemDisplayName= '*xxx*'cwd) || (kMDItemDisplayName= '*xxx*'cwd))&&(kMDItemContentType!=com.apple.mail.emlx)&&(kMDItemContentType!=public.vcard)&&(kMDItemContentType!=com.apple.safari.bookmark))

Click the Save button and save the search with the name File Name Search. Select it in your home directory, choose File » Get Info, and change the permissions to "Read only." Then drag the smart folder to the sidebar of a Finder window.

Now when you want to search, click on File Name Search in the sidebar of a Finder window, click the Edit button, and follow the instructions in the text box. The text you want to change is in this section of the code:
((kMDItemDisplayName= '*xxx*'cwd) || (kMDItemDisplayName= '*xxx*'cwd))
Just replace the xxx with the filename(s) you'd like to find. For instance, change the first one to Apple and the second to Finder, and the query as written will find all filenames that contain either Apple or Finder. If you want to do an "AND" search, change the || to &&.

[robg adds: If you use this often, you may find it easier to remove the entire first section, which contains the instructions, since you'll have it memorized anyway. Just make the command start with the ((kMDItemDisplayName... bit.]
    •    
  • Currently 1.50 / 5
  You rated: 1 / 5 (4 votes cast)
 
[11,578 views]  

10.4: More convenient filename searches | 10 comments | Create New Account
Click here to return to the '10.4: More convenient filename searches' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: More convenient filename searches
Authored by: landis on Jul 06, '07 08:18:30AM

Short delay my @$$....

Sorry, I get so annoyed with Spotlight. I've given up on searches ever actually working or not freezing my computer. I actually miss OS 9 on this side of things.

But, I tried to follow your hint and got stuck. No 'Raw Query' option was available on my drop-down (that took almost a minute with a MacPro, 4GB RAM). My options in the r's are Radiance (HDRI) document, RealOne Player Media Files, RTF, RPNC File, and RTFD.

No joy on Raw Query.



[ Reply to This | # ]
10.4: More convenient filename searches
Authored by: landis on Jul 06, '07 08:26:25AM

Sorry, forgot to mention: OS X.4.10 (just updated last night).



[ Reply to This | # ]
10.4: More convenient filename searches
Authored by: cclifton on Jul 06, '07 08:52:25AM

You're probably clicking in the second drop-down, not the first. The first drop-down has to be changed to "Other..." not "Kind".

---
Curt



[ Reply to This | # ]
No "Raw Query?"
Authored by: noworryz on Jul 06, '07 08:52:55AM

So you clicked on "Kind" and then selected "Other..."?

After you do that, a box should appear that says "Select a search attribute."

You then select "Raw Query" from that box.



[ Reply to This | # ]
10.4: More convenient filename searches
Authored by: Old Toad on Jul 06, '07 08:59:50AM

Seems like more effort than it's worth. I prefer to use NotLight which accepts wild cards if the form of an asterisk.



[ Reply to This | # ]
10.4: More convenient filename searches
Authored by: ddauerbach on Jul 06, '07 12:25:09PM

Pathfinder and Moru keep me happy.



[ Reply to This | # ]
10.4: More convenient filename searches
Authored by: noworryz on Jul 06, '07 09:00:29AM
You might want to put a few spaces on either side of the section you modify; i.e., the section containing:

((kMDItemDisplayName= '*xxx*'cwd) || (kMDItemDisplayName= '*xxx*'cwd))
Rob removed those, probably by accident.

[ Reply to This | # ]
10.4: More convenient filename searches
Authored by: wub-fur on Jul 08, '07 01:31:30PM

If trying this hint on a shared computer you might want to use something other than "XXX" as the string to replace as this combination of letters may pull up search results one doesn't wish to share.



[ Reply to This | # ]
10.4: More convenient filename searches
Authored by: mergatroid on Jul 08, '07 04:08:50PM
The Smart Folder I created did bring up and identify an Orange labeled folder where Spotlight via the menubar did not. The difficulty I find is the naming of files and folders at the spur of the moment. What words of reference are best at the particular moment I will save a file or create a new folder is a most difficult mental task to perform each and every time. Spotlight is ok I suppose. What needs to be written by editors and writers at websites such as MACOSXHINTS are articles clarifying the logic behind better file and folder name creation. I have yet to devise a system that nails it quick. My computer needs are not complicated enough where I need a Super Spotlight function to find particular files; sometimes the occasion of a forgotten file or folder arises though and so I'll keep the Smart folder I created from this article. For the technical aspect I'll rate the article a five star article.

[ Reply to This | # ]
Has to take the cake for the most convoluted was to accomplish something
Authored by: alexmathew on Jul 08, '07 07:46:39PM

that too on a Mac !!!! Where one is supposed to do thing intuitively?
Spotlight may be bad - but this hint is awful.
Right now my Finder is stuck in a beach ball when I tried to remove the xxx and replace with something else!!



[ Reply to This | # ]