[question] search for files pairs with (1), (2) and so-on

Discussion related to "Everything" 1.5 Alpha.
Post Reply
asamirid
Posts: 127
Joined: Sat Oct 13, 2018 12:28 pm

[question] search for files pairs with (1), (2) and so-on

Post by asamirid »

greetings..

i have a folder with alot of files ended with (1) and (2) and more, these files has the same filename but the stem end is different as i mentioned, the attached image show how filenames looks ..

image_2024-01-21_192630189.png
image_2024-01-21_192630189.png (66.79 KiB) Viewed 2119 times

how can i search for these pairs so both files the original one and the (1) or (2) or more displayed in the results ..

i tried to search the forum here for a solution but with no luck ..
albino
Posts: 9
Joined: Mon Jun 19, 2023 5:02 pm

Re: [question] search for files pairs with (1), (2) and so-on

Post by albino »

Maybe try:

Code: Select all

dupe: (1)
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: [question] search for files pairs with (1), (2) and so-on

Post by NotNull »

Does this work for you?

Code: Select all

"C:\your image folder\"   regex:"^(whatsapp image.*PM)"   dupe:regmatch1
If not:
could you post the list of image files as an EFU file and post them here?
I have a script that can generate these files from the EFU file. Makes it possible to "clone" your environment.
void
Developer
Posts: 16669
Joined: Fri Oct 16, 2009 11:31 pm

Re: [question] search for files pairs with (1), (2) and so-on

Post by void »

To quickly find just the (1) files where the original file exists:

regex:^(.*)" "\(\d+\)\.jpg$ fileexists:$1:.jpg



To quickly find duplicated filenames without the (1) part:

regex:^(.*?)(" "\(\d+\))?\.jpg$ dupe:path;regmatch1

(there might not be an existing filename with no (1) -please be careful deleting the filenames with (1))



To show the original file, where the original file exists without (1), please try:

<regex:^(.*)(" "\(\d+\))\.jpg$ fileexists:$1:.jpg> | <regex:^(.*)\.jpg$ regex:sibling:^$1:" "\(\d+\)\.jpg$ >
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: [question] search for files pairs with (1), (2) and so-on

Post by NotNull »

My first attempt was the following:

Code: Select all

 <regex:"^(.*)\.jpg$"    expand:fileexists:"$1: (1).jpg"> | <regex:"^(.*)\(\d\)\.jpg$"    expand:sibling:"$1:.jpg">
  
But that would have failed if .. (1).jpg does not exist (and (2), (3) etc. do.


Is there a way to use wildcards in in either fileexists: or sibling: ?
void
Developer
Posts: 16669
Joined: Fri Oct 16, 2009 11:31 pm

Re: [question] search for files pairs with (1), (2) and so-on

Post by void »

fileexists: and sibling: support Substitution

$1: is expanded for each file/folder.

For example:

regex:sibling:^$1:" "\(\d+\)\.jpg$



wildcards work too with the wildcards modifier:

wildcards:sibling:$1:" "(*).jpg



The next alpha update will have support for:
sibling:$1:" "(*).jpg

The next alpha update will also fix the eating of the trailing >
For now, you'll need to use a space then the trailing >



Please note that substitution can be slow.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: [question] search for files pairs with (1), (2) and so-on

Post by NotNull »

void wrote: Wed Jan 24, 2024 3:09 am regex:sibling:^$1:" "\(\d+\)\.jpg$
So the "trick" is to put the quotes around just the spaces?
My attempt (IIRC) was to enclose the entire function value in "", but that did not yield any results.
So based on your syntax: regex:sibling:"^$1: \(\d+\)\.jpg$" will give no results.
(removing the quotes and replacing the space with \s fixes that too of course)

Will try to remember .. Thanks!
void
Developer
Posts: 16669
Joined: Fri Oct 16, 2009 11:31 pm

Re: [question] search for files pairs with (1), (2) and so-on

Post by void »

Thanks for the feedback NotNull,

The next alpha update will allow $property: inside quotes.



For now, please keep $1: outside quotes.

For example:

regex:sibling:^$1:" "\(\d+\)\.jpg$
regex:sibling:^$1:" \(\d+\)\.jpg$"
regex:sibling:"^"$1:" \(\d+\)\.jpg$"
regex:sibling:^$1:\s\(\d+\)\.jpg$
anmac1789
Posts: 668
Joined: Mon Aug 24, 2020 1:16 pm

Re: [question] search for files pairs with (1), (2) and so-on

Post by anmac1789 »

I've had this kind of question for years and years!!! Thank god someone else made a post about it echoing my same exact delimma. Thank you Thank youuu
void
Developer
Posts: 16669
Joined: Fri Oct 16, 2009 11:31 pm

Re: [question] search for files pairs with (1), (2) and so-on

Post by void »

Everything 1.5.0.1367a improves substitution.

sibling: will now have native support for filename wildcards.

For example:

regex:^(.*)\.jpg$ sibling:$1:" "(*).jpg



substitution will no longer eat the trailing >

For example:

<regex:^(.*)(" "\(\d+\))\.jpg$ fileexists:$1:.jpg> | <regex:^(.*)\.jpg$ regex:sibling:^$1:" "\(\d+\)\.jpg$>



substitution can now be used inside quotes.

For example:

<regex:^(.*)(" "\(\d+\))\.jpg$ fileexists:$1:.jpg> | <regex:^(.*)\.jpg$ regex:sibling:"^$1: \(\d+\)\.jpg$">
Post Reply