How do I create a search that returns multiple file extensions?

I'm trying to create a search that returns all of the documents whose names are *.html OR *.css OR *.js


I open a finder window, browse to the folder I want to search and I hit Cmd+F to start a search. I select + to add a search criterion, I select "File Extension" from the drop-down box, and I enter "html". This immediately finds all the documents that end in html. So far, so good.


Then I press the + to add another criterion. I change it to "File Extention" and enter "css". All the files in the window disappear.


It is clearly trying to find all files that have BOTH html and css extensions -- which don't exist, of course because each file can only have one extension.


I need it to OR those two criteria, not AND them.


I have tried all of the following to no avail:

  • entering "html OR css OR js" into the text-box next to File Extension
  • searching by name and entering "*.html OR *.css OR *.js"
  • searching by kind and entering "html OR css OR js" (this doesn't find js files for some reason)


How do I get a search to return multiple kinds of files?! This is ridiculous! I should be able to enter "*.html OR *.css OR *.js" and have it return all those files in a given folder, but it won't for some reason.


HELP!

MacBook Pro w/ Touch Bar (2018 or later)

Posted on Feb 6, 2019 11:35 AM

Reply

Similar questions

4 replies

Feb 6, 2019 1:44 PM in response to VikingOSX

If you save the following as an AppleScript script, or script bundle, you can double-click on it to produce a new Finder window with the Spotlight search results discussed previously. There is a bug in AppleScript that prevents it from setting the search results view as Arrange by Name, so you will need to do that manually.


Copy/paste into Script Editor and save accordingly.


-- Applies a Spotlight search to open a new Finder window with HTML, CSS Style Sheets,
-- and Javascript files shown in icon view. Need to manually adjust Finder's Arrange by
-- kind to Arrange by Name for uninterrupted icons.

-- The Arrange by Name directive in the code is ignored by Finder

use framework "Cocoa"
use AppleScript version "2.4" -- Yosemite or later
use scripting additions

property NSWorkspace : a reference to current application's NSWorkspace

set query to "(kind:HTML OR kind:Style OR kind:JavaScript) AND (name:.html OR name:.css OR name:.js -(name:.json))"
set result_code to (current application's NSWorkspace's sharedWorkspace)'s showSearchResultsForQueryString:query
if result_code = 0 then return

tell application "Finder"
	tell front Finder window
		set its current view to icon view
		set its arrangement of icon view options to arranged by name
		set its text size of icon view options to 14
	end tell
end tell
return


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I create a search that returns multiple file extensions?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.