How to Use ES to Search Only for Files with Keywords in the Filename?

General discussion related to "Everything".
Post Reply
2976570546
Posts: 8
Joined: Thu Aug 15, 2024 3:32 am

How to Use ES to Search Only for Files with Keywords in the Filename?

Post by 2976570546 »

When I use 'es' to call Everything for searching, I notice that when I search for 'student' files, the 'bin', '01' and other files inside the 'student' folder, which do not contain 'student' in their filenames, are also searched. This is not what I want. Is there a way to only query files that have 'student' in their filenames, just like when using Everything's GUI? :?:
Looking forward to the experts to help me out :geek:
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by void »

ES will search names (not full paths) by default.



Do you have an es.ini in the same location as your es.exe?

Please make sure match_path is disabled in your es.ini:

match_path=0
2976570546
Posts: 8
Joined: Thu Aug 15, 2024 3:32 am

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by 2976570546 »

I originally did not have an es.ini file, so I created one and wrote match_path=0 in it (this is also the only line in the entire file), but it still didn't work. What else might I be missing? :?:
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by void »

Are you calling ES with -p or -match-path ?
2976570546
Posts: 8
Joined: Thu Aug 15, 2024 3:32 am

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by 2976570546 »

with -p
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by void »

Please try without -p

-p = match full path and name.
2976570546
Posts: 8
Joined: Thu Aug 15, 2024 3:32 am

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by 2976570546 »

I thought -p was for limiting the scope of directory access; I never doubted that! My problem is solved, thank you so much! You are such a kind person. :D :D
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by void »

use -path to limit results to a specific folder.

For example:

ES -path "C:\Program Files"
2976570546
Posts: 8
Joined: Thu Aug 15, 2024 3:32 am

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by 2976570546 »

Oh! I understand now, I thought -p stood for 'path' abbreviation, haha, thank you very much!👍👍
2976570546
Posts: 8
Joined: Thu Aug 15, 2024 3:32 am

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by 2976570546 »

A new issue has emerged.
Previously, when I was using Everything to search with ES, I used to combine and exclude folder paths by separating them with spaces and a pipe symbol "|" or a space and an exclamation mark "!".
like "D:\xlj\ERP2022 |D:\xlj\360se6 |D:\xlj\IISDir".
However, this method seems to have stopped working now. Do you know the reason? Moreover, when I tried to revert the -path back to -p, it only detected the first directory path, which indicates that this is probably not the cause.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by void »

Please try escaping | with ^|

es D:\xlj\ERP2022\ ^| D:\xlj\360se6\ ^| D:\xlj\IISDir\


If you are calling from powershell:

es D:\xlj\ERP2022\ `| D:\xlj\360se6\ `| D:\xlj\IISDir\
2976570546
Posts: 8
Joined: Thu Aug 15, 2024 3:32 am

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by 2976570546 »

I tried your methods, but it didn't work.
I tried using "es -n 300 -path D:\ ^| C:\ xlj" to search for folders containing "xlj" in both the D and C drives, but the result was only one item, which was the same as when using "es -n 300 -path D:\ xlj".
When I used "es -n 300 -path C:\ xlj", I was able to find two results.
I also tried the "`|" , and the result was also empty.
Did I make a mistake in some part of it? :shock:
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by void »

-path only allows one folder.
avoid using -path

es -n 300 D:\ ^| C:\ xlj
2976570546
Posts: 8
Joined: Thu Aug 15, 2024 3:32 am

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by 2976570546 »

Really quick, brother! You're really supportive. What would be the impact if I don't use the path option?
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to Use ES to Search Only for Files with Keywords in the Filename?

Post by void »

none.

Please add a trailing backslash to your paths.

For example, if you search for:

"C:\Program Files"

This would match files in C:\Program Files (x86)



Instead use:

"C:\Program Files\"



Examples:

es D:\xlj\ERP2022\ ^| D:\xlj\360se6\ ^| D:\xlj\IISDir\
Post Reply