Page 1 of 1

Search folders containing files with specific extension

Posted: Tue Aug 16, 2022 3:42 pm
by rspai
I have been using Everything for sometime now but am not able to find a way to do this:
I want to list folders that contain only files with extensions .pdf or .epub

Re: Search folders containing files with specific extension

Posted: Tue Aug 16, 2022 4:25 pm
by NotNull
Is this what you have i mind? (if not: please explain in more detail including examples):

Code: Select all

child:*.pdf | child:*.epub

Re: Search folders containing files with specific extension

Posted: Tue Aug 16, 2022 5:39 pm
by horst.epp
That doesn't work
if he realy wants "folders that contain only files with extensions .pdf or .epub"

Re: Search folders containing files with specific extension

Posted: Tue Aug 16, 2022 6:35 pm
by Stamimail
Search Preprocessor has conditions capabilities.
So it seems to be possible for an advanced user.

Re: Search folders containing files with specific extension

Posted: Tue Aug 16, 2022 7:17 pm
by NotNull
Stamimail wrote: Tue Aug 16, 2022 6:35 pm Search Preprocessor has conditions capabilities.
So it seems to be possible for an advanced user.
How? The preprocessor ist 'just' that : a PRE-processor. It gives you functions that expand to a value. Before the search starts, this will be evaluated.
Meaning that it would expand to something that you could type in the search bar. What would that be in this case?


horst.epp wrote: Tue Aug 16, 2022 5:39 pm That doesn't work
if he realy wants "folders that contain only files with extensions .pdf or .epub"
Aha! that is what I missed: the "only" part. Thank you!

If @rspai wants to find folders that contain epub files and/or pdf files and nothing else (beside subfolders), regex to the rescue! :

Code: Select all

child:*.pdf | child:*.epub   !regex:child:^.*\.(?!pdf$)(?!epub$)
(Explanation of this gibberish available if needed)


But first .. let's hear what @rspai has to say ...

Re: Search folders containing files with specific extension

Posted: Tue Aug 16, 2022 7:54 pm
by Stamimail
@NotNull Well done. (I thought that parentheses in regular expressions were only used for grouping, but I see that there are exceptions).
@rspai try also this:

Code: Select all

child:*.pdf | child:*.epub   !regex:child:^.*\.(?!pdf$)(?!epub$) childfoldercount:0
NotNull wrote: Tue Aug 16, 2022 7:17 pm How? The preprocessor ist 'just' that : a PRE-processor. It gives you functions that expand to a value. Before the search starts, this will be evaluated.
Meaning that it would expand to something that you could type in the search bar. What would that be in this case?
If so, would POST-processor tasks be possible using CMD (es.exe) and pipes?

Re: Search folders containing files with specific extension

Posted: Wed Aug 17, 2022 1:10 am
by rspai
Thanks a ton, everyone, for all the inputs.

The very first response by @NotNull was a pointer to what I was looking for. The last two responses by @NotNull and @Stamimail have given me the results I was looking for. (I need to do a sample verification.)

Also, eagerly looking forward to @NotNull offer of "explanation of this gibberish available if needed". Thanks, once again.

Re: Search folders containing files with specific extension

Posted: Fri Jan 19, 2024 5:59 pm
by klark1kent
Old topic, and no follow up needed, but just passing it along. These examples all worked flawlessly me for the first folder, but if the folder contained subfolders, and I went into those subfolders, there were a couple instances where files with other formats were included (in my case .icc and .docx). The first folder though always contained just PDF

Re: Search folders containing files with specific extension

Posted: Sat Jan 20, 2024 5:41 pm
by NotNull
rspai wrote: Wed Aug 17, 2022 1:10 am Also, eagerly looking forward to @NotNull offer of "explanation of this gibberish available if needed". Thanks, once again.
This one slipped through the cracks, so a *little* late:

Code: Select all

!regex:child:^.*\.(?!pdf$)(?!epub$)
regex: = Go in Regular Expression mode
^ = Start of the filename
^.*\. = Read as many characters of the filename as you can, up until teh *last* dot (.) of the filename (meaning we are at the start of the extension of the filename)

! = NOT
$ = End of the filename
(?!pdf$) = look ahead to the end of the filename ( that is the extnsion). It may not be equal to pdf
(?!epub$) = Same for epub

So ^.*\.(?!pdf$)(?!epub$) finds filenames that do NOT have pdf or epub extensions.
The ! (NOT) before regex: makes Everything exclude all folders that do include non-pdf or non-epub files.


klark1kent wrote: Fri Jan 19, 2024 5:59 pm no follow up needed
Sorry, couldn't resist :D ...

The following search query will find all folders that do have only epub or pdf below them, includinbg subfolders.
So any folder that is listed is "guaranteed" to have only pdf and epub files in them. No other type of files.
Empty folders will not be listed.

Code: Select all

descendant-file:*.pdf;*.epub  !regex:descendant-file:^.*\.(?!pdf$)(?!epub$)

Re: Search folders containing files with specific extension

Posted: Thu Jan 25, 2024 1:52 am
by klark1kent
Yep that last string did the trick - and I get it, the same way you couldn't help but respond is the exact reason I couldn't help but provide the feedback.

Re: Search folders containing files with specific extension

Posted: Thu Jan 25, 2024 7:40 pm
by NotNull
:D :thumbsup:

Please keep posting feedback!