Is there an "Advanced Search" in Finder?

Discussion in 'macOS' started by bollweevil, Nov 14, 2009.

  1. bollweevil macrumors 6502

    Feb 1, 2008
    Okay, I have wanted this so many times that I am going to ask you all.

    Is there an "Advanced Search" capability in Finder? I have found the preferences, and the +/- buttons that allow you to add multiple search fields, but this is not enough. I want "and" and "or" conditionals connecting the multiple search fields/criteria. I also DESPERATELY want the ability to search in all subdirectories of directory foo, or just look at files in the directory foo itself. I also really want "is not" for the search fields, instead of just "is". For instance, right now I am looking for " filename is '.py' ", but I really want to add the conditions " do not search subdirectories " and " filename is not 'music' ", because I am seeing all 2000 .py scripts from subdirectories and 500 py scripts with 'music' in the filename which I know I don't want.

    I would love to be able to use Unix path syntax, like foo/*.py, and ~/foo/*.py.

    Regexen would be AWESOME: e.g ^[a-bA-B0-9\./]*/[a-b]*.py$ this regex would find any .py files and NO .pyc files, but only .py files without digits or uppercase in the filename.

    Do people know of a way to tackle any of these?
  2. Eric S. macrumors 68040

    Eric S.

    Feb 1, 2008
    Santa Cruz Mountains, California
    Terminal commands can probably do everything you want. For example, if you want all files in the current directory ending in ".py" but not including "music" in their name:

    ls -1 *.py | grep -v music

    If you want to recursively search a directory tree, the find command can be used:

    find . -name "*.py" -exec ls -1 \{\} \; | grep -v music

    The ls and find commands can both use regex patterns. You can run "man ls" and "man find" and check out how those work.
  3. bollweevil thread starter macrumors 6502

    Feb 1, 2008
    Thank you Eric, but what I really desperately want is a nice GUI to do this. I got the ideas from using ls and find, in fact. The problem with ls and find is that I get a list, but a plain text list is not so easy to sort by 'Last opened' and then resort by 'size', and then right click on one of the files.

    I hesitated to ask this question because it will only save me 30 seconds relative to using terminal each time, but those 30 seconds really add up over dozens and hundreds of searches that I do.

    Do I want Google Desktop or something?
  4. haginile macrumors member

    Dec 13, 2006
    Press "Option" and then click on the + button (should be shown as ...)
  5. bollweevil thread starter macrumors 6502

    Feb 1, 2008
    Thanks Haginile, that is excellent. That answers one of my questions, and makes the entire thread worthwhile, I now know how to in effect do "is not" and "or" as well as the standard "is" and "and".

    Other questions remain. Especially: How do I search non-recursively, for only the immediate contents of this directory.

Share This Page