Secondary Sorting + Regex - How To?

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
dglp
Posts: 9
Joined: Fri Aug 24, 2018 8:37 pm

Secondary Sorting + Regex - How To?

Post by dglp »

I'm looking for a way to identify .jpgs by name and sort them by dimension.

I'm trying to deal with the aftermath of a disc failure for a photo album.
I've got thousands of recovered photos that are re-sized copies of the original.

For example, these are various sizes of the same photo:
20210101_132615.jpg
20210101_132615_02.jpg
20210101_132615_03.jpg
20210101_132615_04.jpg

The metadata is identical for each.

I want to find all the smaller size (dims) copies and remove them.
I cannot do an exclusive search on the original, i.e. find all files of sizes 4096x3072, because the originals vary in size.
So I'm thinking that a search on filename, and a secondary sort on file width/height will help me remove all but the files with largest dimensions.

I see there's a seconday sort function, but it looks like it only operates on a results column, e.g. Shift+right-click on a column heading.
There's no column for width/height, and I see no way to create one.
So maybe there's a RegEx way of doing it?
Maybe I should be setting up a RegEx search from the outset, to find filenames and sort by dimension.

Is that possible?
void
Developer
Posts: 16751
Joined: Fri Oct 16, 2009 11:31 pm

Re: Secondary Sorting + Regex - How To?

Post by void »

Can you determine from the filename if the file is an original photo?

(eg: does the trailing _02, _03, _04 etc indicate a resized photo?)
-If so, the following regex search should give you all the original photos:

regex:(\d+)_(\d+)\.jpg


The following regex search should give you all the resized photos:

regex:(\d+)_(\d+)_(\d+)\.jpg



Everything 1.5a adds the width, height, regex match 1, regex match 2, regex match 3 columns.
Setting a secondary sort in Everything 1.5a.
dglp
Posts: 9
Joined: Fri Aug 24, 2018 8:37 pm

Re: Secondary Sorting + Regex - How To?

Post by dglp »

void wrote: Sun Nov 21, 2021 10:35 am Can you determine from the filename if the file is an original photo?
In most, but not all cases. If I've done a rapid-sequence with the camera, the results have numbered suffixes.
So I could use this as a somewhat more labour-intensive approach by looking to see if it's a resized copy or an in-sequence original.
Everything 1.5a adds the width, height, regex match 1, regex match 2, regex match 3 columns.
Setting a secondary sort in Everything 1.5a.
I'm installing 1.5 and letting it run through the directories. :D :D
dglp
Posts: 9
Joined: Fri Aug 24, 2018 8:37 pm

Re: Secondary Sorting + Regex - How To?

Post by dglp »

This is good!

It's easy to see that the largest file is not necessarily the 'first' one.
At this point, I can't identify the original defintively, partly because the file recovery process has modified some of the metadata. ALL of the files were modified on Oct 15....

But I can filter the results list to exclude the largest of a given group, and delete the rest.

Image
https://ibb.co/P18YbB4
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Secondary Sorting + Regex - How To?

Post by raccoon »

Is your goal specifically to find the photo with the largest dimensions, so you can delete the photos with the smaller dimensions? Or did you upscale some of your photos from smaller to bigger?

It is possible to sort and group by the filename date-segment and secondary sort by dimension. To do this you use a regex pattern that matches the filename date-segment and then Add Column > Search > Regular Expression Match 0. This column excludes the _02.jpg _03.jpg _04.jpg so they do not influence the sort.

Another option is to bulk Advanced Rename the files to replace the _02 _03 suffixes with the dimensions instead, and the a normal filename sort will reveal the largest as Everything 1.5 supports natural number sorting (looking at the whole number, not just the first digit).
Post Reply