Using find, I’m trying to search a folder for files with two different name possibilities, so I’d like to know if there is a way to use multiple -iname criteria. It’s easy to get away with this…
I don’t think so when using the “-name” (or “-iname”) argument but using a regular expression, you can do it:
set search_terms to {"abc", "xyz"}
set the_folder to (((choose folder) as Unicode text)'s text 1 thru -2)
set found_files to (my find_in_folder(the_folder, search_terms))
on find_in_folder(the_folder, search_terms)
set the_folder to quoted form of POSIX path of the_folder
tell (a reference to my text item delimiters)
set {old_tid, contents} to {contents, "|"}
set {search_terms, contents} to {".*(" & search_terms & ").*" as Unicode text, old_tid}
end tell
return (do shell script "find -E " & the_folder & " -iregex " & quoted form of search_terms)'s paragraphs
end find_in_folder