0

I did a search in Spotlight and got 500 results:

enter image description here

I want to group them by folder. Is that possible? I tried right-clicking the column headers but there's no Folder option:

enter image description here

I tried pressing Cmd-J to open view options but couldn't find a Folder option: enter image description here

Is there a way to group these results by which folder they're in?

7
  • Not sure if this is possible with the Finder but if you do this search using the find command in the Terminal app, the results will come out automatically sorted by path and file names combined which means they will be sorted by the folder names first and then the file names. Let me know if you need help with that.
    – Alper
    Oct 1, 2022 at 3:42
  • I would appreciate help. I want to find all files that are not videos (with any extension like avi, dat, mp4, etc) and not folders. Oct 1, 2022 at 5:36
  • 1
    If you want a GUI app, try HoudahSpot which uses the Spotlight index but is more powerful in how to can search and display results (e.g. sorted by path). It is what I would use for your "not videos" scenario.
    – Gilby
    Oct 1, 2022 at 7:29
  • Why you need them grouped by folder? What are you going to do next? For example you can display path near the bottom of the Finder window and from there you can open enclosing folder of the file. Oct 2, 2022 at 4:22
  • I have a folder hierarchy like this: Videos/Bangalore, Videos/Sydney, and other cities, and likewise Photos/Bangalore, Photos/Sydney, and other cities. Now, a lot of Bangalore photos accidentally ended up in Videos/Bangalore, and likewise a lot of Sydney photos ended up in Videos/Sydney. I want to move all them to the appropriate folder. @AivarPaalberg Oct 6, 2022 at 2:28

2 Answers 2

3

This is not a free solution.

HoudahSpot uses the Spotlight index, but with refinements that are not available in Finder.

For this question, there is a "File Path" in the column headers and you can sort by the path by clicking the header. Here is an example:

enter image description here

If you look at the "Locations" section in the left hand pane, you will see an answer to your other question about excluding folders.

I am a paid user of HoudahSpot.

2
  • If we're talking about a third-party search app, do you know any that searches all common cloud services like OneDrive, Google Drive, Basecamp, Dropbox, Notion, etc? Oct 6, 2022 at 2:29
  • 2
    I don't think there is a simple answer. But it is worth a question by itself. The big issue is how do you index the content of files in a cloud service? Is file name search is sufficient? I have a few ideas involving an app like Mountain Duck which mounts cloud services as local drive - but they would need fleshing out.
    – Gilby
    Oct 6, 2022 at 3:48
0

Not sure if this is possible with the Finder. However, per your request and other specifications in your comment to your question, here is how it can be done using the find command in the Terminal app.

In order to search the current directory and the directories below in the Terminal app for the files whose extensions do not consist of, for example, either mp4 or avi, the following command should do the trick:

find -s . -type f \! \( -name "*.mp4" -o -name "*.avi" \)

-s makes find search the files and folders in alphabetical order, -type f makes it search only for files (not folders), and \! serves as the logical operator NOT that makes find exclude the files that meet the given criteria.

You can include as many extensions as you like in between \( and \) as shown above so that the files with those extensions are also excluded from the output. -o serves as the logical operator OR.

As I said in my comment to your OP, the output of the above command will come out automatically sorted by the path and file names combined, which means the files will be sorted by their respective paths first, and, within each path, by their names. The output will show the respective path and name of each file together.

You must log in to answer this question.

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