Return only direct children of a folder in search results, even when deeper matches exist

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
gelliphew
Posts: 2
Joined: Tue Jun 03, 2025 6:59 pm

Return only direct children of a folder in search results, even when deeper matches exist

Post by gelliphew »

I recently started to use this software and I really love it.
I read almost all the documentation but I am not able to understand how to achieve the following.

Let's say I have this folder structure:

Code: Select all

C:\
└── Users\
    └── MyUserName\
        └── MyMainFolder\
            ├── file1.pdf
            └── image1.jpg
            └── Subfolder1\
                └── Subfolder2\
                    └── Subfolder3\
                        ├── file2.pdf
                        └── image2.jpg
I want the results to show only the files and folders directly inside MyMainFolder, so in this case I want to see only file1.pdf, image1.jpg, and Subfolder1.

To achieve this, I tried using

Code: Select all

infolder:MyMainFolder\
but it doesn’t do exactly what I want.

What I want is: if I search for folders or files that are inside MyMainFolder but are further down in the folder hierarchy (in this example: Subfolder2\, Subfolder3\, file2.pdf, and image2.jpg), I don't want them to appear in the results.
Instead, I want the result to show only the folder that is directly inside MyMainFolder and that contains them, in this case that would be Subfolder1.

Since it is difficult to explain by words, I show some examples of what I want:

Code: Select all

search term: .jpg
result: image1.jpg, Subfolder1

Code: Select all

search term: Subfolder3
result: Subfolder1

Code: Select all

search term: file2
result: Subfolder1
void
Developer
Posts: 19839
Joined: Fri Oct 16, 2009 11:31 pm

Re: Return only direct children of a folder in search results, even when deeper matches exist

Post by void »

Thank you for your feedback.

infolder:
and
parent:
match files/folders in the specified full path and filename.


search term: .jpg
result: image1.jpg, Subfolder1
You will need Everything 1.5.

Please try the
descendant:
search function:

parent:c:\users\myUserName\myMainFolder *.jpg | descendant:*.jpg


parent:c:\users\myUserName\myMainFolder
== limit results to files/folders directly in myMainFolder.
*.jpg
== match jpg files directly in myMainFolder.
|
== OR
descendant:
== matches folders that contain a descendant file or folder with the specified name.


search term: Subfolder3
result: Subfolder1
parent:c:\users\myUserName\myMainFolder Subfolder3 | descendant:Subfolder3



search term: file2
result: Subfolder1
parent:c:\users\myUserName\myMainFolder file2 | descendant:file2




parent:
descendant:
gelliphew
Posts: 2
Joined: Tue Jun 03, 2025 6:59 pm

Re: Return only direct children of a folder in search results, even when deeper matches exist

Post by gelliphew »

Thank you so much for the great answer and for the great software! I love it!

I still have a problem, which I can't find a solution.

This is the search I will perform very often: parent:c:\users\myUserName\myMainFolder {search word} | descendant:{search word}

I would like to digit the {search word} one time without having to write everytime {search word} | descendant:{search word}.
Is it possible?
I tried using filters and bookmarks but without success.

---

Another question.
Since Everything 1.5 is still in alpha, I'm wondering if it has some problems or performance issues that I should aware of. Is it good to just use 1.5 and uninstall the 1.4 version?
void
Developer
Posts: 19839
Joined: Fri Oct 16, 2009 11:31 pm

Re: Return only direct children of a folder in search results, even when deeper matches exist

Post by void »

Please try creating the following filter:
  • In Everything, from the Search menu, click Add to filters....
  • Change the Name to: myMainFolder Descendant
    (can be anything you like)
  • Change the Search to:
    parent:c:\users\myUserName\myMainFolder $param: | descendant:$param:
  • Change the macro to: md
    (can be anything you like)
You can now search for:

md:search-word


which expands to:

parent:c:\users\myUserName\myMainFolder search-word | descendant:search-word




-or-

Activate the filter and search for:

search-word


Filters can be activated from the Search menu, Filter bar (View -> Filter Bar), Filter sidebar (View -> Filters), right clicking the status bar, filter macro or filter keyboard shortcut.
Filters can be organized from Search menu -> Organize filters.


Since Everything 1.5 is still in alpha, I'm wondering if it has some problems or performance issues that I should aware of. Is it good to just use 1.5 and uninstall the 1.4 version?
The core is stable.
The UI is still under development.
You can run both side by side or uninstall 1.4 if you find 1.5 works well.
gelliphew
Posts: 2
Joined: Tue Jun 03, 2025 6:59 pm

Re: Return only direct children of a folder in search results, even when deeper matches exist

Post by gelliphew »

Thank you very much, it works!
I have one last question.
When I activate the filter (parent:c:\users\myUserName\myMainFolder $param: | descendant:$param:), if I don't type any word to search, I get a lot of random files in the results. Instead I would expect that since the filter includes :c:\users\myUserName\myMainFolder, the results would show only the files and folder inside c:\users\myUserName\myMainFolder.
I'm wondering if this is a bug or if it's intended behavior.
Last edited by gelliphew on Thu Jun 05, 2025 11:46 pm, edited 1 time in total.
void
Developer
Posts: 19839
Joined: Fri Oct 16, 2009 11:31 pm

Re: Return only direct children of a folder in search results, even when deeper matches exist

Post by void »

From Search -> Organize Filters -> Select your Filter -> Edit...

Change the search to:

parent:c:\users\myUserName\myMainFolder <$param: | descendant:$param:>
gelliphew
Posts: 2
Joined: Tue Jun 03, 2025 6:59 pm

Re: Return only direct children of a folder in search results, even when deeper matches exist

Post by gelliphew »

Thank you very much!
Unfortunately I still have a big problem.
By using $param:, I can search for only one term. Instead I would like to use any number of terms and operators like a normal search. Is it possible?
For example, I have this filter parent:c:\users\myUserName\myMainFolder <$param: | descendant:$param:> and I have this file: alpha beta gamma. If I search for alpha gamma, I get no results.
Last edited by gelliphew on Sat Jun 07, 2025 3:02 pm, edited 2 times in total.
void
Developer
Posts: 19839
Joined: Fri Oct 16, 2009 11:31 pm

Re: Return only direct children of a folder in search results, even when deeper matches exist

Post by void »

From Search -> Organize Filters -> Select your Filter -> Edit...

Change the search to:

parent:c:\users\myUserName\myMainFolder <<$param:> | descendant:<$param:>>
Post Reply