regex - how to find files existing in folders with matching size ?

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

regex - how to find files existing in folders with matching size ?

Post by anmac1789 »

Hello everyone, I use this syntax to find duplicate files which exist in each folder. But, in some folders, dupes exist for which it doesn't have the same filename but the exact size. How can I extend this regex into matching files with size and exist in both folders ?

Code: Select all

<regex:^"dir1\\(.*)$" fileexists:"dir2\\$1:">
<regex:^"dir1\\([^\\]*)$" fileexists:"dir2\\$1:">
<file:regex:"^E:\\(.*)$" fileexists:"S:\\$1:">
<folder:regex:^"E:\\(.*)$" folderexists:"S:\\$1:">
void
Developer
Posts: 16734
Joined: Fri Oct 16, 2009 11:31 pm

Re: regex - how to find files existing in folders with matching size ?

Post by void »

Code: Select all

regex:^"dir1\\(.*)$" fileexists:"dir2\\$1:" sizematch:"dir2\\$1:"
regex:^"dir1\\([^\\]*)$" fileexists:"dir2\\$1:" sizematch:"dir2\\$1:"
file:regex:"^E:\\(.*)$" fileexists:"S:\\$1:" sizematch:"S:\\$1:"
folder:regex:^"E:\\(.*)$" folderexists:"S:\\$1:" sizematch:"S:\\$1:"
size-match:
anmac1789
Posts: 669
Joined: Mon Aug 24, 2020 1:16 pm

Re: regex - how to find files existing in folders with matching size ?

Post by anmac1789 »

void wrote: Wed Oct 09, 2024 9:50 am

Code: Select all

regex:^"dir1\\(.*)$" fileexists:"dir2\\$1:" sizematch:"dir2\\$1:"
regex:^"dir1\\([^\\]*)$" fileexists:"dir2\\$1:" sizematch:"dir2\\$1:"
file:regex:"^E:\\(.*)$" fileexists:"S:\\$1:" sizematch:"S:\\$1:"
folder:regex:^"E:\\(.*)$" folderexists:"S:\\$1:" sizematch:"S:\\$1:"
size-match:

Code: Select all

 Find files or folders where the size matches with another file or folder with the specified filename.
But, I only want to match the file size, not the filename along with the file size because the file names are different.
void
Developer
Posts: 16734
Joined: Fri Oct 16, 2009 11:31 pm

Re: regex - how to find files existing in folders with matching size ?

Post by void »

One way to do this:
Search for:

S:\

Select all files/folders (Ctrl + A)
Press Ctrl + Shift + C to copy the filenames.
Change the search to:

E:\ sizefilelist1:

Right click the sizefilelist1: text in the search box and click Edit File List Slot...
Paste your filenames.



Another option is:

Code: Select all

< dir1\ | dir2\ > dupe:size
< e:\ | s:\ > dupe:size
However, This might list duplicated files just in E: or just in S:
anmac1789
Posts: 669
Joined: Mon Aug 24, 2020 1:16 pm

Re: regex - how to find files existing in folders with matching size ?

Post by anmac1789 »

void wrote: Wed Oct 09, 2024 10:43 pm Another option is:

Code: Select all

< dir1\ | dir2\ > dupe:size
< e:\ | s:\ > dupe:size
However, This might list duplicated files just in E: or just in S:
That's what I'm trying to avoid, duplicates in either folder, I just want to match a file or files with the same size that exist and have dupes in the other folder. I think I will just use grouping and dupe:size instead and sort out the filenames after...
anmac1789
Posts: 669
Joined: Mon Aug 24, 2020 1:16 pm

Re: regex - how to find files existing in folders with matching size ?

Post by anmac1789 »

This assumes that 1. the file exists in two locations and 2. it has the same filename. What if the file exists in both locations with the same size and a different filename. How can I match the files from 2 locations LIKE FILEexists but iirespective of the filename ?
void
Developer
Posts: 16734
Joined: Fri Oct 16, 2009 11:31 pm

Re: regex - how to find files existing in folders with matching size ?

Post by void »

Please try the sizefilelist1: method mentioned above.

With this method you can find matching sizes (same or different filename) in a specific location.
anmac1789
Posts: 669
Joined: Mon Aug 24, 2020 1:16 pm

Re: regex - how to find files existing in folders with matching size ?

Post by anmac1789 »

void wrote: Thu Oct 17, 2024 6:40 am Please try the sizefilelist1: method mentioned above.

With this method you can find matching sizes (same or different filename) in a specific location.
all this does is just list the files in the current search window and then combine it with a second size list.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: regex - how to find files existing in folders with matching size ?

Post by NotNull »

Try this:

Code: Select all

file:  regex:"dir1\\?(.*\\)[^\\]*$" | regex:"dir2\\?(.*\\)[^\\]*$"   dupe:regmatch1;size

For example:

Code: Select all

file:  regex:"S:\\ource folder\\?(.*\\)[^\\]*$" | regex:"T:\\arget folder\\?(.*\\)[^\\]*$"   dupe:regmatch1;size
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: regex - how to find files existing in folders with matching size ?

Post by NotNull »

No feedback, @anmac1789?
anmac1789
Posts: 669
Joined: Mon Aug 24, 2020 1:16 pm

Re: regex - how to find files existing in folders with matching size ?

Post by anmac1789 »

NotNull wrote: Sun Oct 20, 2024 8:49 pm

Code: Select all

file:  regex:"S:\\ource folder\\?(.*\\)[^\\]*$" | regex:"T:\\arget folder\\?(.*\\)[^\\]*$"   dupe:regmatch1;size
I have 2 different paths which contain the same size file different name yet regex wasn't able to match the file. Here is a screenshot of a sample file
image.png
image.png (82.85 KiB) Viewed 1083 times

In this screenshot, this is the 2 folders which contain the same file with a different name



image.png
image.png (66.41 KiB) Viewed 1083 times

In this screenshot, I used the above regex commands and only one of the file is listed. Although, the " | " is used, shouldn't it show both ? or how does the above command actually function if it's just finding files by size ? but also checking if the 2 paths exist the same file size ?
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: regex - how to find files existing in folders with matching size ?

Post by NotNull »

  • The spaces around the OR statement (" | ") are crucial. Otherwise the OR will be seen as part of the first regex (regex "eats" | )
  • Add file: to the query, like the original.
  • Better to disable all search modifiers, in this case Ignore Punctuation and Ignore Whitespace
anmac1789
Posts: 669
Joined: Mon Aug 24, 2020 1:16 pm

Re: regex - how to find files existing in folders with matching size ?

Post by anmac1789 »

NotNull wrote: Sun Oct 27, 2024 3:11 pm
  • The spaces around the OR statement (" | ") are crucial. Otherwise the OR will be seen as part of the first regex (regex "eats" | )
  • Add file: to the query, like the original.
  • Better to disable all search modifiers, in this case Ignore Punctuation and Ignore Whitespace
image.png
image.png (37.94 KiB) Viewed 999 times

this actually gave me the dupes PLUS the pics that doesn't even have the same size or name! I have even disabled Ignore Punctuation and Ignore Whitespace (unchecked). The point is to find the dupes among thousands of files
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: regex - how to find files existing in folders with matching size ?

Post by NotNull »

Your dupe: part of the query is wrong. Should be:

Code: Select all

dupe:regmatch1;size
anmac1789
Posts: 669
Joined: Mon Aug 24, 2020 1:16 pm

Re: regex - how to find files existing in folders with matching size ?

Post by anmac1789 »

NotNull wrote: Sun Oct 27, 2024 7:44 pm Your dupe: part of the query is wrong. Should be:

Code: Select all

dupe:regmatch1;size
How come I can't use something like size-exist ? because this tells me that it checks if 2 sizes are the same in 2 different locations and matches them, without filenames
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: regex - how to find files existing in folders with matching size ?

Post by NotNull »

so .. does it work now?
anmac1789
Posts: 669
Joined: Mon Aug 24, 2020 1:16 pm

Re: regex - how to find files existing in folders with matching size ?

Post by anmac1789 »

NotNull wrote: Sun Oct 27, 2024 7:58 pm so .. does it work now?
no sadly it doesn't work
Post Reply