Search for files in folders that have no subfolders

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
omotrl
Posts: 15
Joined: Sun Oct 02, 2022 4:24 pm

Search for files in folders that have no subfolders

Post by omotrl »

Hi,
this works fine,

Code: Select all

child:.txt childfoldercount:0 
but it produces folders, while I need the search to produce txt files themselves.



Can't figure out how to do it.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Search for files in folders that have no subfolders

Post by NotNull »

Does this give the desired results? (untested)

Code: Select all

ext:txt   sibling-folder:*
EDIT: link

EDIT2: Above query is wrong (see below). This should work:

Code: Select all

ext:txt   !sibling-folder:*
omotrl
Posts: 15
Joined: Sun Oct 02, 2022 4:24 pm

Re: Search for files in folders that have no subfolders

Post by omotrl »

No, it doesn't produce any results. (nor do I understand the concept of searching for a sibling file or folder)
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Search for files in folders that have no subfolders

Post by NotNull »

My bad! Forgot the "!" (was in a hurry)

Code: Select all

ext:txt   !sibling-folder:*
This should search for all txt files with no folder on that same level.
So:
c:\folder1\1.txt with no folders in c:\folder should be reported

c:\folder2\2.txt will not be reported if there exists a c:\folder2\subfolder\

(tested this time :))

You need Everything 1.5 for the sibling-folder function
omotrl
Posts: 15
Joined: Sun Oct 02, 2022 4:24 pm

Re: Search for files in folders that have no subfolders

Post by omotrl »

Sibling seems to be a very specific search, restricting it to a particular level. I, however, need to look up files in folders at any level (in fact at the last level, which may be different for each folder). So if there is a way to do a restrictive search (with sibling), I suppose there is some way to do a more general search?
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Search for files in folders that have no subfolders

Post by NotNull »

omotrl wrote: Sun Oct 02, 2022 8:17 pm restricting it to a particular level
It is restricted to the level where the .txt file is, wherever that may be ...

It would also find:
c:\some\other\folder1\1.txt when there are no folders in c:\some\other\folder1\

and not find
c:\some\other\folder2\2.txt if there is a c:\some\other\folder2\subfolder\

(Sibling = brother/sister, having the same parent)


What happens when you try it?
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search for files in folders that have no subfolders

Post by void »

The following should also work in Everything 1.5:

ext:txt sibling-folder-count:0

(and is a little faster)

sibling-folder-count:
omotrl
Posts: 15
Joined: Sun Oct 02, 2022 4:24 pm

Re: Search for files in folders that have no subfolders

Post by omotrl »

The source of my confusion was that I had thought that sibling referred to the path in which the search is conducted (like in c:\Files the siblings would be items at the level of the Files folder ). Now it's clear that it refers to the search term itself.
It all works, thanks a lot!
Post Reply