I have this folder structure:
Photos
|- 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.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this communityI have this folder structure:
Photos
|- 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.
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.
Find
with the Terminal app that I thought might be useful.