ExifTool Forum

ExifTool => Newbies => Topic started by: wesley on November 05, 2022, 04:44:42 PM

Title: IF and Only IF
Post by: wesley on November 05, 2022, 04:44:42 PM
I have two commands, work great.

exiftool -r -overwrite_original -Comment"<BaseName" /Volumes/Media
exiftool -r -overwrite_original -Title"<BaseName" /Volumes/Media

But I would like them to work "IF and Only IF" the title and or comment is DIFFERENT from BaseName. I'd like to run this semi regularly, but don't want to go through all the trouble if its already been done once.

is that possible?

is it also possible to merge the two commands into one?

Thanks!
Title: Re: IF and Only IF
Post by: Phil Harvey on November 05, 2022, 09:13:11 PM
This should do it:

exiftool -r -overwrite_original -Comment"<BaseName" -Title"<BaseName" -if "not $comment or not $title or $comment ne $basename or $title ne $basename" /Volumes/Media

- Phil
Title: Re: IF and Only IF
Post by: wesley on November 06, 2022, 05:30:48 PM
Quote from: Phil Harvey on November 05, 2022, 09:13:11 PMexiftool -r -overwrite_original -Comment"<BaseName" -Title"<BaseName" -if "not $comment or not $title or $comment ne $basename or $title ne $basename" /Volumes/Media

That doesn't appear to work. I am testing it on a single directory.. relevant metadata is:

ExifTool Version Number         : 12.42
File Name                       : Violin Rehersal (2022).mp4
Directory                       : .
Comment                         : Violin Rehersal (2022).mp4
XMP Toolkit                     : Image::ExifTool 12.42
Title                           : Violin Rehersal (2022).mp4
 
when I run
Quoteexiftool -r -overwrite_original -Comment"<BaseName" -Title"<BaseName" -if "not $comment or not $title or $comment ne $basename or $title ne $basename" ./ 

I get

1 directories scanned
1 files failed condition
0 image files read

The file exist as:
Violin Rehersal (2022).mp4
Title: Re: IF and Only IF
Post by: Phil Harvey on November 06, 2022, 09:05:16 PM
What O/S are you using?  Did you read my signature?

- Phil
Title: Re: IF and Only IF
Post by: wesley on November 07, 2022, 06:25:32 PM
Quote from: Phil Harvey on November 06, 2022, 09:05:16 PMWhat O/S are you using?  Did you read my signature?

- Phil

Of course, that fixed it!

thanks
Title: Re: IF and Only IF
Post by: wesley on November 08, 2022, 03:16:56 PM
Is there a log? or a way to see which failed the condition? more verbose output?


1010 directories scanned
17 files failed condition
0 image files read
Title: Re: IF and Only IF
Post by: StarGeek on November 08, 2022, 08:03:31 PM
Take a look at the -progress option (https://exiftool.org/exiftool_pod.html#progress-:-TITLE) or the -v (-verbose) option (https://exiftool.org/exiftool_pod.html#v-NUM--verbose).
Title: Re: IF and Only IF
Post by: Phil Harvey on November 08, 2022, 08:52:36 PM
Hi Wesley,

To get a log of all files that failed the condition, you can use the -efile4 option, like this:

exiftool -efile4 log.txt ...

Read the -efile option documentation for more details.

- Phil