Multiple fileexist:

Discussion related to "Everything" 1.5 Alpha.
Post Reply
anmac1789
Posts: 668
Joined: Mon Aug 24, 2020 1:16 pm

Multiple fileexist:

Post by anmac1789 »

Is there a way to have multiple fileexist in a regex ? kind of like a check across multiple paths?
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Multiple fileexist:

Post by void »

Use regex: and ( ) to capture the name.

For example:

regex:^c:\\folderA\\([^\\]*)$



Use as many fileexists: terms as you like to compare with other paths.

fileexists:c:\\folderB\\\1 fileexists:c:\\folderC\\\1 fileexists:c:\\folderD\\\1 fileexists:c:\\folderE\\\1

Use \1 to reference the first regex capture group.
Each fileexists: call takes an absolute path.
Use a space for AND or | for OR.



Examples:

Show files in C:\FolderA where the file exists in C:\FolderB and C:\FolderC and C:\FolderD:

regex:^c:\\folderA\\([^\\]*)$ fileexists:c:\\folderB\\\1 fileexists:c:\\folderC\\\1 fileexists:c:\\folderD\\\1

Show files in C:\FolderA where the file exists in C:\FolderB or C:\FolderC or C:\FolderD:

regex:^c:\\folderA\\([^\\]*)$ fileexists:c:\\folderB\\\1 | fileexists:c:\\folderC\\\1 | fileexists:c:\\folderD\\\1



fileexists:
anmac1789
Posts: 668
Joined: Mon Aug 24, 2020 1:16 pm

Re: Multiple fileexist:

Post by anmac1789 »

void wrote: Wed Apr 12, 2023 7:29 am Examples:

Show files in C:\FolderA when the file exists in C:\FolderB and C:\FolderC and C:\FolderD:

regex:^c:\\folderA\\([^\\]*)$ fileexists:c:\\folderB\\\1 fileexists:c:\\folderC\\\1 fileexists:c:\\folderD\\\1

fileexists:
isn't this supposed to be something like

<regex:^"c:\\folderA\\([^\\]*)$" fileexists:"c:\\folderB\\$1:" fileexists:"c:\\folderC\\$1:" fileexists:"c:\\folderD\\$1:">
or am I missing something here ?
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Multiple fileexist:

Post by void »

The < > group is not required here.

You'll need to use the < > grouping if you wanted to show files from all paths.

For example, the following will only show files in C:\FolderA (where they also exist in C:\folderB):

regex:^"c:\\folderA\\([^\\]*)$" fileexists:"c:\\folderB\\$1:"



If you wanted to show files in both C:\FolderA and C:\FolderB (where they exist in both paths):

<regex:^"c:\\folderA\\([^\\]*)$" fileexists:"c:\\folderB\\$1:"> | <regex:^"c:\\folderB\\([^\\]*)$" fileexists:"c:\\folderA\\$1:">

They grouping is needed here to OR the two searches.
anmac1789
Posts: 668
Joined: Mon Aug 24, 2020 1:16 pm

Re: Multiple fileexist:

Post by anmac1789 »

void wrote: Wed Apr 12, 2023 11:00 pm The < > group is not required here.

You'll need to use the < > grouping if you wanted to show files from all paths.

For example, the following will only show files in C:\FolderA (where they also exist in C:\folderB):

regex:^"c:\\folderA\\([^\\]*)$" fileexists:"c:\\folderB\\$1:"



If you wanted to show files in both C:\FolderA and C:\FolderB (where they exist in both paths):

<regex:^"c:\\folderA\\([^\\]*)$" fileexists:"c:\\folderB\\$1:"> | <regex:^"c:\\folderB\\([^\\]*)$" fileexists:"c:\\folderA\\$1:">

They grouping is needed here to OR the two searches.
Ok i see, so the path inside regex will show in the results after it finds a match in the other folder. What if I leave the | (OR) ?
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Multiple fileexist:

Post by void »

The OR (|) is needed, because generally, files will not match both: regex:^"c:\\folderA\\([^\\]*)$" AND regex:^"c:\\folderB\\([^\\]*)$"
anmac1789
Posts: 668
Joined: Mon Aug 24, 2020 1:16 pm

Re: Multiple fileexist:

Post by anmac1789 »

void wrote: Wed Apr 12, 2023 7:29 am Use regex: and ( ) to capture the name.

For example:

regex:^c:\\folderA\\([^\\]*)$



Use as many fileexists: terms as you like to compare with other paths.

fileexists:c:\\folderB\\\1 fileexists:c:\\folderC\\\1 fileexists:c:\\folderD\\\1 fileexists:c:\\folderE\\\1

Use \1 to reference the first regex capture group.
Each fileexists: call takes an absolute path.
Use a space for AND or | for OR.



Examples:

Show files in C:\FolderA where the file exists in C:\FolderB and C:\FolderC and C:\FolderD:

regex:^c:\\folderA\\([^\\]*)$ fileexists:c:\\folderB\\\1 fileexists:c:\\folderC\\\1 fileexists:c:\\folderD\\\1

Show files in C:\FolderA where the file exists in C:\FolderB or C:\FolderC or C:\FolderD:

regex:^c:\\folderA\\([^\\]*)$ fileexists:c:\\folderB\\\1 | fileexists:c:\\folderC\\\1 | fileexists:c:\\folderD\\\1



fileexists:
regex:^c:\\folderA\\([^\\]*)$ all this shows in the results is the parent folders inside the main folder.

Its still confusing to me how to use regex:^c:\\folderA\\([^\\]*)$ fileexists:c:\\folderB\\\1 fileexists:c:\\folderC\\\1 fileexists:c:\\folderD\\\1
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Multiple fileexist:

Post by void »

Please try the following search to include subfolders and files:

regex:^c:\\folderA\\(.*)$



Use the Regular Expression Match 1 column to see the text being captured.



fileexists: uses the same regex syntax.
Use \1 to recall the captured text.
anmac1789
Posts: 668
Joined: Mon Aug 24, 2020 1:16 pm

Re: Multiple fileexist:

Post by anmac1789 »

void wrote: Fri Apr 14, 2023 12:43 am Please try the following search to include subfolders and files:

regex:^c:\\folderA\\(.*)$



Use the Regular Expression Match 1 column to see the text being captured.



fileexists: uses the same regex syntax.
Use \1 to recall the captured text.
Do you mean something like this:
<regex:^c:\\folderA\\(.*)$" fileexist:"folderB\\$1:"> ??
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Multiple fileexist:

Post by void »

$1: is the same as \1

The following should give the same results:
<regex:^c:\\folderA\\(.*)$" fileexist:"folderB\\$1:">
<regex:^c:\\folderA\\(.*)$" fileexist:"folderB\\\1">
regex:^c:\\folderA\\(.*)$" fileexist:"folderB\\\1"
anmac1789
Posts: 668
Joined: Mon Aug 24, 2020 1:16 pm

Re: Multiple fileexist:

Post by anmac1789 »

void wrote: Fri Apr 14, 2023 11:42 am $1: is the same as \1

The following should give the same results:
<regex:^c:\\folderA\\(.*)$" fileexist:"folderB\\$1:">
<regex:^c:\\folderA\\(.*)$" fileexist:"folderB\\\1">
regex:^c:\\folderA\\(.*)$" fileexist:"folderB\\\1"
Unfortunately none of the 3 expressions work for me. I have even added quotation to the beginning of " <regex:^ " Same with the other 2 expressions
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Multiple fileexist:

Post by void »

Could you please share the exact path you are using? or a mock-up at least.
anmac1789
Posts: 668
Joined: Mon Aug 24, 2020 1:16 pm

Re: Multiple fileexist:

Post by anmac1789 »

void wrote: Sat Apr 15, 2023 7:14 am Could you please share the exact path you are using? or a mock-up at least.
Sure, the exact path I am using is from the first regex expression

<regex:^"U:\\regex test folder 1\\(.*)$" fileexist:"U:\\regex test folder 1 \(brackets\)\\$1:">


Screenshot 2023-04-15 032435.jpg
Screenshot 2023-04-15 032435.jpg (86.58 KiB) Viewed 4669 times
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Multiple fileexist:

Post by void »

Thanks for the sample folders.

You are using fileexist: instead of fileexists:



What results do you see with the search:

<regex:^"U:\\regex test folder 1\\(.*)$" fileexists:"U:\\regex test folder 1 \(brackets\)\\$1:">
anmac1789
Posts: 668
Joined: Mon Aug 24, 2020 1:16 pm

Re: Multiple fileexist:

Post by anmac1789 »

void wrote: Mon Apr 17, 2023 7:00 am Thanks for the sample folders.

You are using fileexist: instead of fileexists:
Lol, good catch that's my mistake
void wrote: Mon Apr 17, 2023 7:00 am What results do you see with the search:

<regex:^"U:\\regex test folder 1\\(.*)$" fileexist:"U:\\regex test folder 1 \(brackets\)\\$1:">
There is a typo above, it should be fileexists with the added plural -"s" added. Here is a screenshot of the above syntax,

Screenshot 2023-04-17 114553.jpg
Screenshot 2023-04-17 114553.jpg (49.79 KiB) Viewed 4237 times

This only shows note.txt in the top level. It doesn't show note.txt in subfolders
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Multiple fileexist:

Post by void »

I made the same typo!


Please try the following search to find both:

<regex:^"U:\\regex test folder 1\\(.*)$" fileexists:"U:\\regex test folder 1 \(brackets\)\\$1:"> | <regex:^"U:\\regex test folder 1 \(brackets\)\\(.*)$" fileexists:"U:\\regex test folder 1\\$1:">
anmac1789
Posts: 668
Joined: Mon Aug 24, 2020 1:16 pm

Re: Multiple fileexist:

Post by anmac1789 »

void wrote: Wed Apr 19, 2023 10:54 am I made the same typo!


Please try the following search to find both:

<regex:^"U:\\regex test folder 1\\(.*)$" fileexists:"U:\\regex test folder 1 \(brackets\)\\$1:"> | <regex:^"U:\\regex test folder 1 \(brackets\)\\(.*)$" fileexists:"U:\\regex test folder 1\\$1:">
Yes this syntax finds diplicate files from both folders. Is therr a way to find a duplicate file in predefined deeper level subfolders or would something more simpler than regex be used for that purpose lioe path/* ?
Post Reply