Search Only for Parent Folders, excluding subfolders

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
inthevoid
Posts: 13
Joined: Thu May 05, 2016 1:04 pm

Search Only for Parent Folders, excluding subfolders

Post by inthevoid »

Hello,

I am trying to figure out how to search only for parent folders of a given name.

The parent:<path> option needs a specific path to work.

What I am looking is to search only for parent folders, in all drives (not a specified path), excluding subfolders of each parent folder.

Is this possible?

Thank you
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Search Only for Parent Folders, excluding subfolders

Post by NotNull »

So, when you have a C:\MyFolder\MyFile.txt and you search for MyFile, you want it to report C:\MyFolder?

Use
child:myfile
inthevoid
Posts: 13
Joined: Thu May 05, 2016 1:04 pm

Re: Search Only for Parent Folders, excluding subfolders

Post by inthevoid »

File name is irrelevant. I want to search for folders but only the parent and not subfolders.

For example, if I have

C:\My Folder1\Subfolder1\Subfolder2\etc...
D:\My Folder1\Subfolder1\Subfolder2\etc...



and I search for Folder1, I want to return, C:\My Folder1 and D:\My Folder1 excluding any subfolders, just the parent folders of any given folder search.

Can it be done?

Thank you
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Search Only for Parent Folders, excluding subfolders

Post by NotNull »

A couple of examples:

Try
folder: regex:"Folder1"$


This will search for all folders which names end with Folder1
If you have the exact folder nmae, you can search for:
folder: regex:"\\exact folder name"$

-or-
folder: wfn:"exact folder name"
inthevoid
Posts: 13
Joined: Thu May 05, 2016 1:04 pm

Re: Search Only for Parent Folders, excluding subfolders

Post by inthevoid »

What you have suggested is a very handy search. However is it possible to reverse it to search for folders that begin with a folder name? I don't get the desired results as I am looking for parent folders.

Also the parent folder name might have additional words in it.

For example, I might have

C:\My Folder1 Apples\Subfolder1\Subfolder2\etc...
D:\My Folder1 Apples\Subfolder1\Subfolder2\etc...

So when I search for "My Folder 1", to get only parent folders that have "My folder 1" part of the parent folders name.
In this case it would be

C:\My Folder1 Apples
D:\My Folder1 Apples

-

Another example would be if I have

C:\My Folder1 Apples\Subfolder1\Subfolder2\etc...
D:\My Folder1 Oranges\Subfolder1\Subfolder2\etc...

and search for "My Folder 1", to get as a result

C:\My Folder1 Apples
D:\My Folder1 Oranges\

-

Another example would be if I have

C:\A\My Folder1 Apples\Subfolder1\Subfolder2\etc...
D:\B\My Folder1 Oranges\Subfolder1\Subfolder2\etc...

and search for "My Folder 1", to get as a result

C:\A\My Folder1 Apples\
D:\B\My Folder1 Oranges


I hope I am making sense.

Thank you
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Search Only for Parent Folders, excluding subfolders

Post by NotNull »

Certainly.

If you want only folders that start with "some text", search for:
folder: regex:"\\some text[^\\]*"$


Or:
folder: wfn:"some text*"



If you want only folders with "some text" anywhere in the name, search for:
folder: regex:"\\[^\\]*some text[^\\]*"$


Or:
folder: wfn:"*some text*"


(not tested, but should work)

EDIT:Tested.
therube
Posts: 4580
Joined: Thu Sep 03, 2009 6:48 pm

Re: Search Only for Parent Folders, excluding subfolders

Post by therube »

"topmost"

viewtopic.php?p=14448#p14448

folder: folder1 !*folder1*\*

?
inthevoid
Posts: 13
Joined: Thu May 05, 2016 1:04 pm

Re: Search Only for Parent Folders, excluding subfolders

Post by inthevoid »

Thank you for all of the replies.

I tried all suggestions but what worked for me was

folder: folder1 !*folder1*\*

Thank you all for taking the time to help!
Post Reply