I have this folder structure:

|- Bangalore
|- Sydney
|- Videos

How do I search in Photos excluding the Videos subfolder?

I don't want to permanently exclude the subfolder from Spotlight, just for this particular search.

  • 1
    See my answer to your other question.
    – Gilby
    Oct 2, 2022 at 3:45

1 Answer 1


Based on the directory structure in your example and assuming you wish to search for the files whose extension, for example, includes the keyword mpv under the Photos directory or any of its subdirectories, but not the Videos directory right under it, you can use the find command through the Terminal app as follows:

find . -name "*.*mpv*" -o -path ./Videos -prune

The command above assumes you are in the Photos directory in the Terminal app as you issue this command.

If you wish to search for the files whose extensions include either the keyword mpv or just avi with other criteria being the same as above, you can use the following find command:

find . \( -name "*.*mpv*" -o -name "*.avi" \) -o -path ./Videos -prune

You can search for as many extensions as you like at the same time using find by adding more keywords in between \( and \) as shown above. -o serves as the logical operator OR.

  • Actually I'm looking for all videos irrespective of extension: m4v, mp4, 3gp, avi, vob, dat... How is that possible using find? Please also give me the Finder solution for this. Oct 1, 2022 at 3:40
  • 1
    Unfortunately, I did not update the answer with an option involving the Finder because it does not work as I thought it would and I doubt it is possible to do it with the Finder. However, I included another example of Find with the Terminal app that I thought might be useful.
    – Alper
    Oct 1, 2022 at 5:12

You must log in to answer this question.

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