OS X Finder Question

Discussion in 'Apple' started by Gary, Dec 25, 2013.

  1. Gary

    Gary Guest

    When you bring up finder, there is a spotlight-type box at the top.
    Enter text and it will show you all the files whose names contain that
    text. My question is whether you can enter a regular expression in
    this spotlight-type box?
    Gary, Dec 25, 2013
    1. Advertisements

  2. Unix utilities can sometimes take RegEx. But the MacOS GUI doesn't
    usually allow this. I tried searching for files named "foo.*" and it
    found none, even though foo.txt and foo.bar exist in the directory.

    Use Terminal and UNIX find or locate if you want to use RegEx.
    Michael Vilain, Dec 25, 2013
    1. Advertisements

  3. Gary

    JF Mezei Guest

    Spotlight does not just give you list of file names matching the search
    string, but also files where the string was found in the content (for
    files that Spotlight can scan/index contents).
    JF Mezei, Dec 25, 2013
  4. Gary

    dorayme Guest

    Probably not but it might be useful to know that in extensive
    searches, press Command F (a venerable command combo from way back).
    This brings the Spotlight search engine up in a most useful interface
    where you have many choices to limit your search. One that I might
    draw your attention to is the "Kind" dropdown choice of "Other...".
    This brings up a significant welter of further delimiting choices.
    dorayme, Dec 25, 2013
  5. Gary

    Tim Streater Guest

    And by clicking the little + over on the right you can add search terms.

    Something I frequently do is to add a term saying "System files *are*
    Tim Streater, Dec 25, 2013
  6. Gary

    Siri Cruz Guest

    You can open a Finder window and then Edit>>Find (or Command-F) to get more
    control over how it searches.
    To glob on file names:
    find topleveldirectory .. -name 'globpattern'

    To match the file path with an RE:
    find topleveldirectory .. -regex 'RE'

    To grep on the file contents:
    find topleveldirectory .. -exec grep -H -e 'RE' \{\} \;

    You can combine options and add others like -type f to only return plain files.

    You can search the Spotlight database (which extracts metadata from files) with
    Siri Cruz, Dec 25, 2013
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.