It seems to be impossible to search for files in the Mac Finder in two or more separate locations at the same time. But you can do it ina tricky way by editing the criteria of a Saved Search. While not quick, this does give you the ability and you can modify it later to search in the same locations for different things.
You can also watch this video at YouTube.
Watch more videos about related subjects: Finder (321 videos).
You can also watch this video at YouTube.
Watch more videos about related subjects: Finder (321 videos).
Video Transcript
Hi, this is Gary with MacMost.com. Today let me show you how to search for files in two or more different folders at the same time in the Finder.
MacMost is brought to you thanks to a great group of more than 700 supporters. Go to MacMost.com/patreon. There you can read more about the Patreon Campaign. Join us and get exclusive content and course discounts.
So when you search for files in Spotlight or the Finder you can look in your entire hard drive or in a specific location like the Documents folder or subfolder in that. But what if you wanted to look in two different folders. Two folders that were in different locations on your hard drive at the same time. Not all the folders in the same level but two completely different folders. Let me give you an example.
Here I've got a folder called Project A and under that a folder called Some Files. Let's say I want to look for files that happen to be in there. But I also want to look in Project B and here's another folder with files in it. I want to search in both of those places. Now in this example there aren't many files in those two locations. But imagine in a situation where you had hundreds or thousands of files in different folders in different places. You just wanted to search in those places, not at the top level and see everything that you've got.
Let's dig down here to the first folder and if I do Command F, for find, you could see here that I could search either this Mac, the entire Mac, all of my files or the current folder. So I have the current folder selected. But there's no way to add another folder to this. There is no modification here that will allow me to say look for files in these two, three, or four specific folders. But, of course, there always is a way without using third party software or anything. You just have to get a little tricky.
So first let's go and look for files in here by Name and let's say Name Contains and let's use the word Notes. You could see there are four files in that folder that have the word Notes in them. Now I also want to include files with the word Notes in the name in that other folder as well. So the first thing I want to do is Save the Search. I want to click Save here and it will create a saved search, also known as a Smart Folder, and it will do it in the Saved Searches location which is actually in my Library folder.
I don't want to put it there because I want to work with this special file. So instead I'm going to go to my Documents folder here. I'm going to create a new folder called Special Searches. Just a place to put this and I'll hit Create. I'll call this something like Search for Notes and I'll Save it. You can see I also added it here to the sidebar so I can easily click here and use it.
Let's go back up into the Documents folder here into Special Searches. Here's that saved search file. Now what we're going to do here is modify it manually so it includes both of those folders. So I'm going to run TextEdit. I'm going to use Spotlight to search for TextEdit and run TextEdit. I'm going to drag and drop the saved search special file there and open it up in TextEdit. This is what's actually in that file.
It's a text file. It's perfectly readable containing all the criteria for that search. You could even see here that the raw query is looking for display name that includes notes with anything before it or anything after it. Then here if we look at SearchScopes we could see the path inside an array, an array means a list of things. So we have a list of one thing, one path. So you would think we could add a second path there. But before we do that notice that in addition to SearchScopes there's also CurrentFolderPath and there's an array in there with the same path. If we look further down we'll see FXScopeArrayOfPaths with that path yet again. So it's there in three places.
Now some experimentation shows that I could actually add a second path here to this FXScopeArrayOfPaths and it will work. But I think it's a little cleaner if I add it in all three places. So let's create a new line here and I will format it the same way. So I'll tab over use string here and then slash Users and then my user name Documents. Now that second folder was actually in Project B slash and the name of it was actually Notes and Such. Then I will close the little tag there like that.
Now let's add that in the other two places. So I'll Copy it and I'll move here and I'll hit Return. I'll tab over and I'll Paste it in. So now we have the second path added under Current Folder Path. Also, I'm going to do the same thing here but the format is a little different. So I'll Paste it in but notice that it goes to the top level. System/Volumes/Data and then slash Users. So let's go and add that so now it matches the same format but this time it's looking in Documents Project B Notes and Such instead of Some Files.
So now I've added it in those three places. Now I'm going to Save from TextEdit and Close the document. Now I've saved it there so if I double click on this it should show me the result of the search for Notes in both of those locations. But it doesn't. If I double click you can see I still see the same results. So what's going on here? Well, we need to restart the Finder. So I'm going to Exit out of this to make sure I'm not in there. So now I just went back and I could see the saved search file.
Now I can restart the Finder in one of several ways. I could do it in the Terminal. I can do it by force quitting the Finder. I could also hold the Option key down and click on the Finder down here. You could see there's Relaunch. Select that. All my Finder windows will close and reopen. You may want to make sure you're not running any other apps when you're doing this. Now I can double click on this and the results are going to be all the files with notes in the name from both folders. As a matter of fact if I click here and I look at the bottom I could see the path bar. I could see this is from Notes and Such. This one is from Some Files. Notes and Such and Some File. So it is actually showing me the results from both of those locations.
I can even modify this now that I've created it. I can click here and go to Show Search Criteria. You can see now it says Search This Mac and then it just gives me the name of the search here at the top. But I could change the criteria here at the top. So in addition to Notes another word that I used was things. So now if I look here I could see some of these are in Some Files and others are in Notes and Such. So I can change what I'm searching for very easily. I can't really change the actual locations without opening it up again in TextEdit.
If I go to Exit here it's going to ask me to Save the Smart Folder. I will. If you go to look in the Text file sometimes you'll see the path is only in two places now instead of one. I'm not sure why the difference. But it still does work. I can return, say, to the Documents level here and click in the Sidebar and get the results for the saved search.
So this isn't the most convenient way to do this. Of course if you want to clutter your Mac with more third party apps you can get search apps that will do more. You can also do this in the Terminal as well. But while this isn't very convenient to do just a quick one time search, it is a good way to setup a Saved Search that can search multiple locations and you can keep going back to it time and time again. Plus you also get some insight as to how saved searches work and perhaps you can play around with more of the details inside of the text of the saved search file.
Beautiful Gary, love the ingenious hack. However, wouldn't it be nice if Apple would just include a modifier menu in the search function? Given that the functionality is there already it doesn't seem that it would be too difficult for it to be included in a modifier menu. Without your tutorials many of Mac's secrets would remain just that :)