Match the file name only

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Match the file name only

Post by vefatica »

Using the command line tool (1.1.0.18) or the GUI (1.4.1.1023) and the search expression "v:\f*" I can't figure out how to get v:\file and not get v:\folder\*.

I read the topic "Filter not to match path" ... no help.

Help! Thank you.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Match the file name only

Post by NotNull »

Everything will show matching files as well as folders
Does helping file: to your search query? Like:

Code: Select all

ES.exe file:v:\f*
(likewise, folder: will show only matching folders
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

file: prevents it from showing folders, but if folder names match the search criterion, it shows files in those folders. I'd like it to only show things in the top level directory (like the old DIR command without /S); in other words, not recurse. For example (below), show v:\j.txt and not show V:\junk\age2dhms.btm.

Code: Select all

v:\> u:\es.exe file:v:\j*
V:\junk\age2dhms.btm
V:\j.txt
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

What does Everything_SetMatchPath(FALSE) do? I can't see it's effect.

Assuming filename "X:\Some Folder\abcde.txt":
When set to FALSE, Everything will only search in the last "\" separated components of the full path of the filename.
In the example: abcde.txt
So searching for "m" will not give a match; searching for "e" will give a match (abcdE.txt)

When set to TRUE, Everything will search in all "\" separated components of the full path of the filename.
In the example: X:\Some Folder\abcde.txt
So searching for "m" will give a match (soMe) ; searching for "e" will also give a match (abcdE.txt as well as somE)
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Match the file name only

Post by NotNull »

vefatica wrote: Sun Jun 11, 2023 9:41 pm file: prevents it from showing folders, but if folder names match the search criterion, it shows files in those folders. I'd like it to only show things in the top level directory (like the old DIR command without /S); in other words, not recurse. For example (below), show v:\j.txt and not show V:\junk\age2dhms.btm.

Code: Select all

v:\> u:\es.exe file:v:\j*
V:\junk\age2dhms.btm
V:\j.txt
OK, you are using Everything 1.4 ... Missed that in the opening post.
(I wrongly assumed version 1.5 and that uses a different type of wildcard matching/ globbing: * for "1 level deep" ; ** for "/S")

For 1.4, a couple of options:

Code: Select all

es.exe   file:V:\j   depth:1
es.exe   file:V:\j*   depth:1
es.exe   file:   startwith:j   parent:V:\
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

Thanks for that!

I think my own CLI version is based on 1.1.0.20 stuff (header, cli.c, and lib). Using "depth:" I could easily add a "/D(epth) N" command line option, defaulting to N == 1 (my preference), but I'd have to monkey with the user-specified search criterion.

Where can I get an up-to-date SDK and how is the newer wildcard matching different? Would updating make what I want to do easier?
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Match the file name only

Post by NotNull »

The most recent version can be found here

However, it is not entirely up-to-date when using Everything 1.5 as some of the new 1.5 features are still under development (and that would cause "shooting at moving targets").
But all existing features are supported, so you're good :D

vefatica wrote: Sun Jun 11, 2023 10:14 pm how is the newer wildcard matching different? Would updating make what I want to do easier?
Yes, with Everything 1.5
(note the * vs ** syntax)

Code: Select all

T:\>dir /a
 Volume in drive T is RAMDISK
 Volume Serial Number is 6898-80AC

 Directory of T:\

25/09/2022  15:43    <DIR>          $RECYCLE.BIN
11/06/2023  23:54                13 aa.txt
11/06/2023  23:56    <DIR>          Instance_time
10/06/2023  22:54    <DIR>          System Volume Information
12/06/2023  00:20    <DIR>          TEMP
               1 File(s)             13 bytes
               4 Dir(s)     574.214.144 bytes free

T:\>es t:\i*
T:\Instance_time

T:\>es t:\i**
T:\Instance_time\ff
T:\Instance_time
T:\Instance_time\Everything-time.backup.db
T:\Instance_time\Everything-time.db
T:\Instance_time\Everything-time.ini
T:\Instance_time\Everything64.exe
T:\Instance_time\find.efu
T:\Instance_time\GO.cmd
T:\Instance_time\No Time Zone 0ffset.efu
T:\Instance_time\Plugins-time.ini
T:\Instance_time\Search History-time.csv
T:\Instance_time\Time Zone 0ffset.efu

T:\>
(the behaviour of * and ** is configurable, btw. See star_all: )
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Match the file name only

Post by NotNull »

There is one issue though:
The SDK does not support Everything named instances yet.
The only way to run Everything 1.4 and 1.5 side-by-side, is to make one of them make use of a named instance.
By default Everything 1.5 uses a named instance, but that can be changed.

The ES.exe commandd-line tool can make use of instances. It bypasses the SDK for that. Don't know how that works, but it should be possible to figure out from source code of ES (part of the download)
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

Ooh, that looks good! Basically * means depth:1 and **means depth unspecified ... is that right?

I had already found the latest SDK and changed my CLI project to use the new header and library. It built with no problem but es

Code: Select all

v:\t*
is still recursing. Am I misunderstanding or missing something?
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Match the file name only

Post by NotNull »

vefatica wrote: Sun Jun 11, 2023 10:46 pm Ooh, that looks good! Basically * means depth:1 and **means depth unspecified ... is that right?
In your case, it does.
More general: c:\some\folder\path\i* will find files/folders in c:\some\folder\path\ that start with i, but not in subfolders of that path.
Here depth would be 4

I had already found the latest SDK and changed my CLI project to use the new header and library. It built with no problem but es

Code: Select all

v:\t*
is still recursing. Am I misunderstanding or missing something?
Your CLI project is likely still talking to Everything 1.4 and this new wildcard matching is part of Everything 1.5.
In 1.4, "*" still means "/s"
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

Yoy're right. My EVERYTHING.EXE came with my shell (TCC, from JPSoft). It's v1.4. I can install 1.5 but, later, updating TCC will either change the service EXE or remove the service. I can deal with either of those but it's a small pain. I'll lobby the author to update Everything.

What about using the 1.4 service together with the 1.5 client/server?

Thanks again!
void
Developer
Posts: 16680
Joined: Fri Oct 16, 2009 11:31 pm

Re: Match the file name only

Post by void »

Everything 1.5 will run along side Everything 1.4.

Everything 1.5 alpha runs in a "1.5a" instance.

Everything 1.5 will have its own Everything 1.5a Service.
The Everything 1.5 service is incompatible with Everything 1.4. (and vise versa)



If you want to call Everything 1.5 with the SDK you will need stop Everything 1.4 from running and disable the 1.5a instance:
  • Exit Everything 1.4 (File -> Exit)
  • In Everything 1.5, from the Tools menu, click Options.
  • Click the Advanced tab on the left.
  • To the right of Show settings containing, search for:
    alpha
  • Select alpha_instance.
  • Set the value to: false
  • Click OK.
  • Exit Everything 1.5 (File -> Exit)
  • Restart Everything 1.5
Last edited by void on Mon Jun 12, 2023 3:36 am, edited 1 time in total.
Reason: added: restart Everything 1.5
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

Hmmm! I DL'd the alpha, did -install-service and -startup. The search window works fine (* and ** too). But my CLI interface fails. It has no explicit IPC in it. I just parse the command line, and ...

Code: Select all

	Everything_SetSearch(psearch);
	Everything_SetMatchCase(match_case);
	Everything_SetRegex(regex);
	Everything_SetMatchPath(match_path);
	Everything_SetMatchWholeWord(match_whole_word);
	Everything_SetMax(sort ? EVERYTHING_MAX_RESULTS : num);
	if ( !Everything_QueryW(TRUE) )
	{
		Qprintf(STD_ERR, L"Everything_Query error: %lu\r\n", Everything_GetLastError());
		goto exit;
	}
and I get

Code: Select all

Everything_Query error: 2  (Everything search client is not running)
The client is running, started elevated from the same shell where I issued the ES command.

When my shell plugin loads, it does this.

Code: Select all

	if ( bElevated )
		ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD);
Any ideas?
void
Developer
Posts: 16680
Joined: Fri Oct 16, 2009 11:31 pm

Re: Match the file name only

Post by void »

Please try disabling the alpha_instance as mentioned above.

Please try restarting Everything 1.5 after disabling the alpha_instance.

Does the issue persist?
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

OK, when I resterted the client unelevated my CLI search tool works in both an unelevated shell and an elevated one. If I didn't say earlier, my tool is in a plugin DLL for the shell.

Is there a problem with the client running elevated?
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

Yup, it's OK now. I hadn't restarted the client after disabling the alpha_instance. It works now with the client started elevated or not.

Thanks!!!!
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

P.S., I like how it automatically picked up on my Windows dark theme.
therube
Posts: 4955
Joined: Thu Sep 03, 2009 6:48 pm

Re: Match the file name only

Post by therube »

(Probably in 1.5alpha only ?)

Name:

So something like,
es.exe name:f* V:
.


Note that something like,
name:v:/f*
is invalid.
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

vefatica wrote: Sun Jun 11, 2023 9:46 pm What does Everything_SetMatchPath(FALSE) do? I can't see it's effect.

Assuming filename "X:\Some Folder\abcde.txt":
When set to FALSE, Everything will only search in the last "\" separated components of the full path of the filename.
In the example: abcde.txt
So searching for "m" will not give a match; searching for "e" will give a match (abcdE.txt)

When set to TRUE, Everything will search in all "\" separated components of the full path of the filename.
In the example: X:\Some Folder\abcde.txt
So searching for "m" will give a match (soMe) ; searching for "e" will also give a match (abcdE.txt as well as somE)
That's what I'd expect and like, but I must me misunderstanding something. Below, I have used Everything_SetMatchPath(FALSE) but it's matching the "lo" in a path component.

Code: Select all

v:\> es file:v:\lo
V:\Logfile.PML
V:\logfile.pml.zip
V:\longpath.btm
V:\lotsacolors.btm
V:\LocalDumps\mapm.exe.6552.dmp
V:\LocalDumps\mapm.exe.13204.dmp
therube
Posts: 4955
Joined: Thu Sep 03, 2009 6:48 pm

Re: Match the file name only

Post by therube »

I think it's going to be this:
More general: c:\some\folder\path\i* will find files/folders in c:\some\folder\path\
So even though you have set Everything_SetMatchPath to False, the above (files/folders) still applies.


Though name: (which I suppose says to search the name: field ?) I'd think will probably work for you?
vefatica
Posts: 36
Joined: Sun Jun 11, 2023 6:27 pm

Re: Match the file name only

Post by vefatica »

Thanks for mentioning "name:". I don't see it on the "searching" web page.

What about the relationship between ** and nopath: or name:? "**" seems to kill both of them.

Code: Select all

v:\> es nopath: v:\lo*
V:\LocalDumps\
V:\Logfile.PML
V:\logfile.pml.zip
V:\longpath.btm
V:\lotsacolors.btm

v:\> es nopath: v:\lo**
V:\LocalDumps\
V:\LocalDumps\lofile.txt
V:\Logfile.PML
V:\logfile.pml.zip
V:\longpath.btm
V:\lotsacolors.btm
V:\LocalDumps\mapm.exe.6552.dmp
V:\LocalDumps\mapm.exe.13204.dmp
therube
Posts: 4955
Joined: Thu Sep 03, 2009 6:48 pm

Re: Match the file name only

Post by therube »

Oh, basename:, filename:, name: are synonyms.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Match the file name only

Post by NotNull »

vefatica wrote: Mon Jun 12, 2023 4:17 pm That's what I'd expect and like, but I must me misunderstanding something. Below, I have used Everything_SetMatchPath(FALSE) but it's matching the "lo" in a path component.
You understood correctly.
However, that setting gets overruled through the search itself. If a search query contains a path separator (backslash), Match Path will be enabled again.
Everything has a setting to overrule this, but the most straightforward solution would be to use one of the following:
v:\f*
(version 1.5)
parent:V:\ file:startwith:f
(1.4 as well as 1.5)
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Match the file name only

Post by NotNull »

vefatica wrote: Mon Jun 12, 2023 4:53 pm What about the relationship between ** and nopath: or name:? "**" seems to kill both of them.
nopath: is a search modifier and *what* it modifies should follow immediately after (without extra space in between).

So your query
nopath: something
nullifies nopath:, leaving just "something"


(BTW: i noticed that one of my replies was done by editing your message. Now it is just "mess" ... Sorry!)
Post Reply