For example, how do you search for all folders that contain ".mp3" files (on OS X)?

1 Answer 1


I don't think it's possible using Finder, but you can easily find these folders via Terminal

find . -name '*.mp3' | sed 's|/[^/]*$||' | sort -u

Some explanations:

  • find lists all files (and their paths) ending in mp3 in the current folder and everything "beneath" it
  • sed strips away the last part of each line produced by find which does not contain a / (which practically results in the file name getting removed)
  • The result so far is a list of folders containing mp3 files. If a folder contains more than one such file, it will be listed several times so we use sort -u (unique) to remove duplicates while sorting.

You must log in to answer this question.

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