Search by file attribute 'Rating'

English support forum

Moderators: white, Hacker, petermad, Stefan2

IanP
Junior Member
Junior Member
Posts: 6
Joined: 2020-04-28, 14:47 UTC

Search by file attribute 'Rating'

Post by *IanP »

Looking for a way to search by the rating attribute. In windows, I can type this into the search bar e.g: "Rating: >4". If I search my photos folder, it returns all photos that have a rating > 4.

What I'm looking to do is consolidate my photos library. I spent a lot of time adding attributes like rating, tags, geotags etc. Then my hard drive crashed and I lost everything back to my last backup.
I've got many duplicates (result of creating folders like 'favourite holiday photos'), some have had attributes modified, but some 'duplicates' have different metadata e.g. rating. I'm basically trying to find all duplicates of the same file (find duplicates by name), then from this list, pick files that have a specific rating and assign that rating to all duplicates of this photo.

End goal is to delete duplicates without losing the meta data. How can I do this? I'm trying to find a plugin for specific attributes, but I'm not having any luck with 'rating' which is the main one I want to use.
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: Search by file attribute 'Rating'

Post by *tuska »

Hello and welcome,
IanP wrote:... I'm trying to find a plugin for specific attributes ...
ImageMetaData for JPG comment, Exif, IPTC and XMP metadata 2.3.6.2

Custom columns view:

Code: Select all

Field: [=jpg-comment.Xmp_xmp_RatingStars]

Code: Select all

Plugin		Property		OP	Value:
jpg-comment	Xmp_xmp_RatingStars	=	*****
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Search by file attribute 'Rating'

Post by *petermad »

You can also search for shelldetails:Rating provided by the ShellDetails plugin < https://totalcmd.net/plugring/shelldetails.html > .

If you are not using English Windows, "Rating" will be in the language of your Windows (German: "Bewertung", Danish: "Klassifikation").

In order to search for the value you have to change the value of State in the [{64440492-4C8B-11D1-8B70-080036B11A03}9] section in ShellDetails.ini from:
State=131681
to
State=131810

Which makes the field numeric in stead of alphabetic.

Values for the Rating are:
* = 1
** = 25
*** = 50
**** = 75
***** = 99

This way you can search with shelldetails:Rating < 75 to find all images with a rating below 4.
Last edited by petermad on 2020-04-28, 18:58 UTC, edited 2 times in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: Search by file attribute 'Rating'

Post by *tuska »

2petermad
Thank you very much for your information and the tip! :)
German

Code: Select all

Custom columns view:
[=shelldetails.Bewertung]

Plugin		Property		OP	Value:
shelldetails	Bewertung		>	98

******************************************************
%COMMANDER_PATH%\ShellDetails.ini

[{64440492-4C8B-11D1-8B70-080036B11A03}9]
Caption=Bewertung
UseDefault=1
State=131810
IanP
Junior Member
Junior Member
Posts: 6
Joined: 2020-04-28, 14:47 UTC

Re: Search by file attribute 'Rating'

Post by *IanP »

Thanks very much. The image meta data plugin is perfect for finding files with star rating and editing that attribute on other files.

So now I can find files with particular star rating in the directory
I can also find duplicates in the directory
How would I find duplicate files where at least one of the files has a star rating = 5?
edit: Obviously they're not identical duplicates due to different metadata. But same file name.
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: Search by file attribute 'Rating'

Post by *tuska »

IanP wrote: 2020-04-29, 14:07 UTC How would I find duplicate files where at least one of the files has a star rating = 5?
- Search in separate process... Alt+Shift+F7
- Tab "Advanced" - ☑ Find duplicate files - ☑ same name - ☑ same size --> ☐ same size (edited, see below...)

- Tab "Plugins" -  ☑ Search in plugins - ◉ AND (all match)

Code: Select all

  Plugin	Property		OP	Value:
  jpg-comment	Xmp_xmp_RatingStars	=	*****
  Click on button "Start search", then on "Feed to listbox"...


Option:
Overview: View Mode | Auto Switch Mode | Custom columns view
... e.g. to get the Name and path, etc. shown automatically after "Feed to listbox".
Last edited by tuska on 2020-04-30, 13:07 UTC, edited 1 time in total.
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Search by file attribute 'Rating'

Post by *petermad »

Maybe not "same size" - it seems that if I set the Rating via Windows context menu, the file size gets changed.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: Search by file attribute 'Rating'

Post by *tuska »

petermad wrote: 2020-04-30, 10:43 UTC Maybe not "same size" - it seems that if I set the Rating via Windows context menu, the file size gets changed.
Thanks for the hint!
I fully agree.
IanP
Junior Member
Junior Member
Posts: 6
Joined: 2020-04-28, 14:47 UTC

Re: Search by file attribute 'Rating'

Post by *IanP »

Thanks. The problem I have is that I'm specifically looking for instances where the photos don't have the same rating; usually one is rated and the other is not. So if I filter to rating = *****, then neither appear in the search....
  • I took the photo.
    I created some 'highlights' folders.
    I got an app that searches for photos within a directory and allows me to rate, tag, geotag, album, face recognition etc. So it adds a bit of metadata to the photos as I do this.
    I rated a lot of photos. Many were the actual file in the highlights folder, but many were not.
    I've got a lot of duplicate photos where the metadata is on one or the other file, but not both.
    I want to find all 'duplicates' where at least one of the photos has a rating (it may be only one, or perhaps both).
    Now set this rating to both photos.
    Now I can go through and delete duplicates without losing the ratings I spent so long going through and assigning to my photos
In the unlikely case that both of them had been given a rating and they were different, I guess I'd take the highest rating, but this is the edge case and I'm not really worried if I get one or the other.

Has anyone got a suggestion for this particular scenario? I'm thinking something along the lines of a way to search the listbox for ratings that are not equal for files that have the same name...?
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: Search by file attribute 'Rating'

Post by *tuska »

Duplicates with different ratings can be found, e.g. as follows:

- Search in separate process... Alt+Shift+F7
- Tab "Advanced" - ☑ Find duplicate files - ☑ same name - ☐ same size

- Tab "Plugins" -  ☑ Search in plugins - ◉ AND (all match)

Code: Select all

  Plugin	Property		OP	Value:
  shelldetails  Rating			>=	1
- Tab "Plugins" -  ☑ Search in plugins - ◉ OR (any match)

Code: Select all

  Plugin	Property		OP	Value:
  jpg-comment	Xmp_xmp_RatingStars	=	*****
  jpg-comment	Xmp_xmp_RatingStars	=	****
  jpg-comment	Xmp_xmp_RatingStars	=	***
  jpg-comment	Xmp_xmp_RatingStars	=	**
  jpg-comment	Xmp_xmp_RatingStars	=	*
  jpg-comment	Xmp_xmp_RatingStars	=	~       '~' seems to mean "no rating" - could not get it to work *)
Click on button "Start search", then on "Feed to listbox"...

[Here one should also create an 'Auto Switch Mode',... so that the rating is displayed in the result window
  We can do this later.].

*) '~' seems to mean "no rating": --> I will ask the author (Email to support on 4.5.2020).
    If we could get this to work, then I think your problem is completely solved.

Btw, you could use a button:

Code: Select all

LOADSEARCH <stored search> ... Open stored search operation
e.g. a button with command:

Code: Select all

LOADSEARCH Duplicates_RatingStars
OR
Button, which calls the stored search operation in a separate task(!)

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_EXE%
/S=F:LDuplicates_RatingStars
wciconex.dll,26
%COMMANDER_EXE% /S=F:LDuplicates_RatingStars|Duplicates & RatingStars - Search in separate task!


-1
IanP
Junior Member
Junior Member
Posts: 6
Joined: 2020-04-28, 14:47 UTC

Re: Search by file attribute 'Rating'

Post by *IanP »

Okay we're getting somewhere. I found with the ratings that if I rated a photo and then unrated it (not in total commander, but within the app I use) this causes the rating to be set to '~'. Interestingly the ratings on the unedited photos are actually blank. Not '-', not '~', not '0'. Just blank. It'll be interest to see what feedback you get form the author.

But a few more questions before we need to delve into that further.

1 - Wouldn't the condition for rating >=1 apply to all photos due to setting as an 'and' condition? i.e. it then wouldn't find a scenario where photo A has a rating but photo B does not.

2 - I'm also lacking the knowledge to execute this suggestion. How do I create 2 separate conditions for the and / or parts of the conditions? If I could type it I'd be fine, but I only get the one option within the 'Search in a separate process' panel to select either 'AND' or 'OR'. How do I set a multiple condition statement that groups some of the conditions as 'ands' and some others as 'or' conditions?
IanP
Junior Member
Junior Member
Posts: 6
Joined: 2020-04-28, 14:47 UTC

Re: Search by file attribute 'Rating'

Post by *IanP »

To answer question 1 for myself, after a bit of testing it appears that any files with the 'blank' rating value are totally omitted from a search result for duplicates regardless of if you're searching for '=' or '!='. Even if I only search for rating != 5, it only returns files that have a non-blank rating value that is not equal to 5. So blank values are even omitted from a standard search.

To get around this I can:
Create a saved search parameter for 'Any star rating' (including 1-5 stars, ~, -)
Load all files in the photos directory into the listbox, then Mark > Select group > 'Any star rating' > Mark > Invert selection.
File > Change attributes > Rating = '0' (or perhaps '-')

Now the duplicates search with a star rating condition will return these files in the results. Super close to solving this! The last step is how to execute a multiple set of and / or conditions as per question 2 in previous post.
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: Search by file attribute 'Rating'

Post by *tuska »

IanP wrote:I found with the ratings that if I rated a photo and then unrated it (not in total commander, but within the app I use)
this causes the rating to be set to '~'.
Thank you for pointing that out. Now I know what the tilde '~' in the plugin "jpg-comment" is used for.
IanP wrote:To answer question 1 for myself, after a bit of testing it appears that any files with the 'blank' rating value are totally omitted
from a search result for duplicates regardless of if you're searching for '=' or '!='.
Yes, that's why I made another inquiry on 05 May 2020 to the author Lefteous for ShellDetails 1.26 (Content plug-in).
The search queries shown above only referred to currently possible search parameters. Please see also examples below...
IanP wrote:The last step is how to execute a multiple set of and / or conditions as per question 2 in previous post.
◉ AND (all match) ...> click on button "Help" in "Find Files" window on tab "Plugins" for explanation
◉ OR (any match) ...>

With a single rule "rating >=1" it does not matter whether AND or OR is selected.

But if you click on "More rules", then you have to decide
(a) whether each of the rules listed should apply (AND)
     If in a search query with 7 rules (*,**,***,****,*****,~,<no stars>) only 1 rule does NOT match,
     then the search result is empty, i.e. you will get NO search hits!
... OR ...
(b) whether at least one of the listed rules should apply (OR), i.e. even if only one of the rules applies,
     the result is displayed. In this case, however, several or all rules may also apply.

Just try a few pictures to find out if what you are looking for appears in the search results.
Examples

Code: Select all

◉ AND (all match)

  Plugin	Property		OP	Value:
  jpg-comment	Xmp_xmp_RatingStars	=	*****
  jpg-comment	Xmp_xmp_RatingStars	=	****

  This is an invalid search rule, because an image cannot have a rating of 4 AND 5 stars at the same time.
  The search result is empty, i.e. you will get NO search hits! --> "Search results: [No files found]"

Code: Select all

◉ OR (any match) rule

  Plugin	Property		OP	Value:
  jpg-comment	Xmp_xmp_RatingStars	=	*****
  jpg-comment	Xmp_xmp_RatingStars	=	****
  jpg-comment	Xmp_xmp_RatingStars	=	***
  jpg-comment	Xmp_xmp_RatingStars	=	**
  jpg-comment	Xmp_xmp_RatingStars	=	*
  jpg-comment	Xmp_xmp_RatingStars	=	~
  jpg-comment	Xmp_xmp_RatingStars	=	no stars (this parameter does not yet exist)

Code: Select all

◉ OR (any match) rule

  Plugin	Property		OP	Value:
  shelldetails  Rating			>=	1        (Rule 1: Finds *,**,***,****,*****)
  shelldetails  Rating 			=	~        (this parameter does not yet exist)
  shelldetails  Rating 			=	no stars (this parameter does not yet exist)

  Plugin	Property		OP	Value:
  shelldetails  Rating			>=	1        (Rule 1: Finds *,**,***,****,*****)
  jpg-comment	Xmp_xmp_RatingStars	=	~	 (Rule 2: Finds '~')
  jpg-comment	Xmp_xmp_RatingStars	=	no stars (this parameter does not yet exist)  
But I think there's something else coming from the plugin authors...
IanP
Junior Member
Junior Member
Posts: 6
Joined: 2020-04-28, 14:47 UTC

Re: Search by file attribute 'Rating'

Post by *IanP »

Firstly, I can only search for rating '=' or rating '!='. The select list does not off '>' or '<'and I'm not aware of a way to type. Is there a way to type a query? That could make this a lot easier!

But this brings us back to the original catch 22.

Scenario 1 - If I have a single rule "rating =1", and I'm searching for duplicates by name, then it will only return a result where BOTH files = 1. Even if I could search >=1, it will only return a result where both files >=1. So this doesn't satisfy the case where I want to find any instance of a duplicate where at least one file does have a rating e.g. file A = *****, file B = blank.

Scenario 2 - If I set up a duplicate search with an 'or' statement with 7 rules (*,**,***,****,*****,~,-) (note that I cannot find a way to search for a blank rating value), then it only returns results where BOTH the files meet AT LEAST ONE of the conditions. Again doesn't solve scenario where one file has rating = blank.

Scenario 3 - If I use 'Files > Change attribute' to set any file which currently has a blank rating to '~', then now they WILL show up on the search (as per my last post). But now doing the search in scenario 2 will now return ALL duplicates because the or statements cover every possible rating including '~'. i.e. it returns the same result as if I simply searched for duplicates by name without anything to do with ratings.

So, nothing so far quite gets us to a full solution.

I've *almost* got a solution using a slightly different approach:
Step 1 - Search for duplicates by name within parent photo directory. This returns >13,000 files (so roughly 6,500 photos that have duplicates, assuming most of them only have a single duplicate)
Step 2 - Perform a subsequent search from within the above search result by ticking the box 'F2 Search in found files/folders'. Set the criteria for:
jpg-comment Xmp_xmp_RatingStars = ***** . This returns a list of files that do have a duplicate (by name) and are rated 5 stars (about 1500 files).
Step 3 - this is where the solution is incomplete. Is there a way I can search the photos directory for ANY of those 1500 file names? If I can do that, I can change all their attribute to 5 star. Then repeat for 4, 3, 2, 1. Then I can go through and delete the duplicates while retaining the ratings, as it won't matter which file I delete, both files will have the rating... Please tell me there's a way to do this last step?!
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Re: Search by file attribute 'Rating'

Post by *tbeu »

You cannot find or select files not having a property set. The reason is a feature shortcoming of the content plugin interface, see this 10 year old topic: https://www.ghisler.ch/board/viewtopic.php?p=200715#p200715
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
Post Reply