[Suggestion] folderexists: to support trailing \

Discussion related to "Everything" 1.5 Alpha.
Post Reply
NotNull
Posts: 5298
Joined: Wed May 24, 2017 9:22 pm

[Suggestion] folderexists: to support trailing \

Post by NotNull »

folderexists: currently does not support foldernames ending with a backslash, like C:\


Reason for asking is a bookmark I'm using to find "dead links" -- shortcuts without existing target:
ext:lnk regex:shortcut-target:(^(.:|\\).*$) !<folderexists:\1 | fileexists:\1>

It considers links to C:\ as invalid so it reports false positives.


Any other way to get the desired results is fine by me too.
(couldn't get preprocessor function [rtrim,"\1","\"] to work in this case; rtrim will probably get parsed before \1 is known)
void
Developer
Posts: 15474
Joined: Fri Oct 16, 2009 11:31 pm

Re: [Suggestion] folderexists: to support trailing \

Post by void »

The next alpha update will ignore the trailing slash.



It's easier to not capture the trailing \

For example:

ext:lnk regex:shortcut-target:^(.*?)\\?$ folderexists:\1



Applying the preprocessor to folderexists: is a pain.
You need to use the expand: search modifier and you need to escape the preprocessor text so it is not prematurely expanded.

For example:

ext:lnk regex:shortcut-target:^(.*?)$ expand:folderexists:"[rtrim:\1,\\]"

I'm just using quotes here to escape the preprocessor.



I'll look into making this easier by using the newer column formulas.

For example:

ext:lnk regex:shortcut-target:^(.*?)$ folderexists:rtrim($1:,"\\")
NotNull
Posts: 5298
Joined: Wed May 24, 2017 9:22 pm

Re: [Suggestion] folderexists: to support trailing \

Post by NotNull »

void wrote: Mon Nov 06, 2023 2:48 am ext:lnk regex:shortcut-target:^(.*?)\\?$ folderexists:\1
Nice!!
void wrote: Mon Nov 06, 2023 2:48 am You need to use the expand: search modifier
Completely forgot about expand: ... Thanks for the refresher!



So, with that, my bookmark search to find "dead links" now looks like:

Code: Select all

ext:lnk   regex:shortcut-target:(^(.:|\\).*?)\\?$   !<folderexists:\1 | fileexists:\1>
The
(.:|\\)
part is to exclude non-filesystem shortcuts like Control Panel items, shell folders ("download", etc) and shortcuts to Windows settings.
2023-11-06 21_16_12-.png
2023-11-06 21_16_12-.png (39.08 KiB) Viewed 1059 times

Search =
void
Developer
Posts: 15474
Joined: Fri Oct 16, 2009 11:31 pm

Re: [Suggestion] folderexists: to support trailing \

Post by void »

Everything 1.5.0.1360a improves search syntax.



You can now do the same thing with this simple search:

ext:lnk exists:$shortcut-target:

Everything will now substitute $property-name: with the property value from the current file/folder.
substitution will work with most search functions.

Substitution



Added an exists() formula function.

Formulas give you more control than substitution, allowing you to manipulate property values.

For example, trim the shortcut:

*.lnk folderexists(rtrim($shortcut-target:,"\"))

Formulas



Everything will now ignore the trailing slash passed to exists: / folderexists:



Dode links (.lnk) search could now be set to:
ext:lnk !exists:$shortcut-target:
Post Reply