Search folders containing files with specific extension
Search folders containing files with specific extension
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
I want to list folders that contain only files with extensions .pdf or .epub
Re: Search folders containing files with specific extension
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
That doesn't work
if he realy wants "folders that contain only files with extensions .pdf or .epub"
if he realy wants "folders that contain only files with extensions .pdf or .epub"
Re: Search folders containing files with specific extension
Search Preprocessor has conditions capabilities.
So it seems to be possible for an advanced user.
So it seems to be possible for an advanced user.
Re: Search folders containing files with specific extension
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.Stamimail wrote: ↑Tue Aug 16, 2022 6:35 pm Search Preprocessor has conditions capabilities.
So it seems to be possible for an advanced user.
Meaning that it would expand to something that you could type in the search bar. What would that be in this case?
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$)
But first .. let's hear what @rspai has to say ...
Re: Search folders containing files with specific extension
@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:
@rspai try also this:
Code: Select all
child:*.pdf | child:*.epub !regex:child:^.*\.(?!pdf$)(?!epub$) childfoldercount:0
If so, would POST-processor tasks be possible using CMD (es.exe) and pipes?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?
Re: Search folders containing files with specific extension
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.
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.
-
- Posts: 21
- Joined: Thu Aug 11, 2022 1:26 am
Re: Search folders containing files with specific extension
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
This one slipped through the cracks, so a *little* late:
Code: Select all
!regex:child:^.*\.(?!pdf$)(?!epub$)
^ = 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.
Sorry, couldn't resist ...
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$)
-
- Posts: 21
- Joined: Thu Aug 11, 2022 1:26 am
Re: Search folders containing files with specific extension
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
Please keep posting feedback!