

Any is the right selection, so you can leave that alone. The ellipsis button creates an Any of the Following Are True entry, which is what you need to have multiple criteria for images in a single search.Now hold down the Option key, and the plus button in the upper right next to the entry that was created (which starts “Name” and “matches”) changes to an ellipsis (…).In the upper-right corner, click the plus (+) button.Press Command-Option-spacebar to create a Finder Spotlight search window.You have to go through a little rigamarole to get the fields you need: See File Metadata Query Expression Syntax and for using other search operators.The simplest way to do this with Spotlight is via a Finder-based search, for which you can create a Smart Folder to repeat it later without losing the window settings. To avoid opening bash scripts or other non-document files, you may restrict file contents by additional search attributes. Additional cd is for case insensitive and ignoring diacritical marks, e.g., fred will return both, Frédéric and FrEDeric.įindpaper will restrict search to results under a specific path (recursive) while openpaper pie*201 will open a (or first of multiple results) search result or openpaper pie*201 3 will open third result entry. There is no need to prepend or append * to your query as the search pattern, '*$1*' already tags wild card entry at beginning and end of your query. To search for files with words, pie and 2016 anywhere in the file name, do spot pie*2016 #or Now, either source ~/.bash_aliases or open a new terminal load functions. Open "$(mdfind -name -onlyin "/Users/foo/articles" "kMDItemDisplayName='*$1*'cd" | sed -n "$")" # default to open the first entry unless 2nd positional argument is given Mdfind -onlyin "/Users/foo/articles" "kMDItemDisplayName='*$1*'cd" # restrict to files under (recursive) a specific path # find any item matching search query in file name I find this easier than typing long string of query in spotlight window.Īdd following functions in ~/.bash_aliases.

You may use following command line functions to quickly find and open relevant file.
