Is there any way to take a list of file paths from find (or alike) and view them in a Finder window?

For example, say I'd like to see a single Finder window containing "all of the .mp3 files in the current path and its subdirectories excluding the directory archive/".

I'd like to take this output:

$ find "$(pwd -P)" -iname "*.mp3 -not -path "./archive/*""

And view those files in a Finder window as if I was doing a regular Finder search.

I realize I can do an advanced search within Finder but for my purposes, it's too limited.

Thanks, Erik

2 Answers 2


How about temporarily assigning them all a unique label (maybe using something like tag), and then making a Finder smart folder for that label?

Here's what I did:

  1. Install tag with brew install tag.
  2. In Finder, File > New Smart Folder.
  3. Click "This Mac".
  4. Click +, and add "Tags" "Is" temp0. (This will get replaced later with a new temporary tag.)
  5. Click Save, and save it as something like /Users/youruser/Library/Saved Searches/Custom Tag.savedSearch.
  6. Create a script like this (with SMART_FOLDER set to the path above, without the extension):
set -e
SMART_FOLDER="/Users/youruser/Library/Saved Searches/Custom Tag" # without extension

# pass all arguments to find, and store in array
RESULTS=($(find "$@"))
unset IFS

# assign a temporary label
LABEL=temp$(date +%s)
tag -a "$LABEL" "${RESULTS[@]}"

# create a temporary savedSearch with the new label.
# if we just update it, Finder doesn't seem to notice.
sed "s/temp0/$LABEL/g" "$SMART_FOLDER.savedSearch" > "$SMART_FOLDER-$LABEL.savedSearch"
open "$SMART_FOLDER-$LABEL.savedSearch"

echo "Showing results for $LABEL. Press return to remove label."
tag -r "$LABEL" "${RESULTS[@]}"
rm "$SMART_FOLDER-$LABEL.savedSearch"
  1. Save it as something like ffind, somewhere in your default $PATH.
  2. Make it executable with chmod u+x ffind.
  3. Now you can use it just like find, e.g. ffind . -name '*.html'. It will pass its arguments to find, assign a temporary label to the results, create a temporary smart folder that finds that label, and open it. Then it will wait for you to press return.
  4. When you press return, it will clear the label from the files, and delete the temporary smart folder.

A short AppleScript would work:

tell application "Finder" to reveal {"/Users/me/1.mp3" as POSIX file, "/Users/me/2.mp3" as POSIX file, "/Users/me/3.mp3" as POSIX file}

and you can run that directly from terminal with osascript:

osascript -e 'tell application "Finder" to reveal {"/Users/me/1.mp3" as POSIX file, "/Users/me/2.mp3" as POSIX file, "/Users/me/3.mp3" as POSIX file}'

I'm not proficient enough with shell to convert the find output to the above command (I'd rather use a text editor for this), but it should be doable.

  • Thanks, @Glorfindel. This is a start however if I have a file at ~/Desktop/1.mp3 and a file at ~/Desktop/subdir/2.mp3 the Finder will reveal them in separate tabs. In hindsight, I wasn't clear enough: I'd like all of the files to open in the same Finder window. Maybe this isn't doable. Commented Oct 5, 2021 at 13:12
  • Updated my post for clarification. Commented Oct 5, 2021 at 13:13
  • 1
    Ah, you mean it should take ~/Desktop as the root folder and 'expand' the subdir folder (and select both files). I'm not sure if that is possible - I hope somebody else has a better solution then.
    – Glorfindel
    Commented Oct 5, 2021 at 13:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .