How to use PickLabel Tag in Conditions?

Started by keineantwort, November 23, 2024, 05:17:34 AM

Previous topic - Next topic

keineantwort

Hello everyone.

I am quite new to exiftool. I am trying to use exiftool in combination with Hazel to automate my photo backup and sorting workflow.
First I want to use digiKam to set the PickLabel to values 1 (delete), 2 (keep) or 3 (printable). The XMP-Value is set in the file. I verified that with exiftool -s DCIM/Camera/20241118_114409.jpg:
...
Notes                           : Caption MSC TEST
ColorLabel                      : 0
PickLabel                       : 3
Urgency                         : 0 (reserved)
Pick                            : 1
Good                            : True
...

When I try exiftool -a -XMP:PickLabel -s -b DCIM/Camera/20241118_114409.jpg,
martin@keineantwort-Mac ~ % exiftool -a -XMP:PickLabel -s -b DCIM/Camera/20241118_114409.jpg
3% 

When I try exiftool -filename -if "defined $XMP:PickLabel" DCIM/Camera/ I get this result:
martin@keineantwort-Mac ~ % exiftool -filename -if "defined $XMP:PickLabel" DCIM/Camera/
    1 directories scanned
   13 files failed condition
    0 image files read

When I try exiftool -filename -if "$xmp:PickLabel eq '3'" DCIM/Camera/, I get this result:
martin@keineantwort-Mac ~ % exiftool -filename -if "$xmp:PickLabel eq '3'" DCIM/Camera/
    1 directories scanned
   13 files failed condition
    0 image files read

I do not understand, why the last two examples are not working.

I think my goal should be something like
exiftool -filename -if "$xmp:PickLabel eq '3'" DCIM/Camera/

I have no clue how to accomplish that. Do you have any hints?

stoffball

Quote from: keineantwort on November 23, 2024, 05:17:34 AMWhen I try exiftool -filename -if "$xmp:PickLabel eq '3'" DCIM/Camera/, I get this result:
martin@keineantwort-Mac ~ % exiftool -filename -if "$xmp:PickLabel eq '3'" DCIM/Camera/
    1 directories scanned
   13 files failed condition
    0 image files read

I do not understand, why the last two examples are not working.

On the Mac you need to swap single and double quotes.
On Mac $xmp:PickLabel inside the double quoted string is replaced with the corresponding variable. You must use single quote to prevent this replacement.

keineantwort

Quote from: stoffball on November 23, 2024, 08:40:20 AMOn the Mac you need to swap single and double quotes.
On Mac $xmp:PickLabel inside the double quoted string is replaced with the corresponding variable. You must use single quote to prevent this replacement.
Wow. 😮
I expected really a lot - not that. 😆

That is the solution:
martin@keineantwort-Mac ~ % exiftool -filename -if '$xmp:PickLabel eq "3"' DCIM/Camera/
======== DCIM/Camera/20241118_114409.jpg
File Name                       : 20241118_114409.jpg
    1 directories scanned
   22 files failed condition
    1 image files read