ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: robertklink on December 26, 2019, 06:08:05 PM

Title: Stymied by -IF condition
Post by: robertklink on December 26, 2019, 06:08:05 PM
Using CMD window on Windows 10 OS.

I want to increment ModifyDate (EXIF 0x132) by 1 year, but only IF the current ModifyDate is prior to 2019 - having difficulty with the IF portion.

Should be simple I'm thinking.
Here's the command that I think should work:
exiftool -ModifyDate+="1:0:0 0:0:0" -if "$ModifyDate lt "2018:12:31"" "C:\Users\rober\Pictures\Advance DTO 1 year Sandbox\1990"

Result is:
1 directories scanned
  463 files failed condition
    0 image files read

I know that there are lots of files in that directory with ModifyDates in the vicinity of 2018:03:31 12:23:04

I've tried numerous permutations of the above command (e.g. le, <, 2020:01:01) but they yielded either the same "failed condition" or some other syntax complaint. The "add one year" command works fine WITHOUT the -IF portion.

Suggestions please?





Title: Re: Stymied by -IF condition
Post by: StarGeek on December 26, 2019, 06:44:15 PM
You need double quotes on the outside, single quotes inside.

exiftool -ModifyDate+="1:0:0 0:0:0" -if "$ModifyDate lt '2018:12:31' " "C:\Users\rober\Pictures\Advance DTO 1 year Sandbox\1990"

Example:
C:\>exiftool -ModifyDate y:\!temp\Test4.jpg
Modify Date                     : 2018:03:31 12:23:04

C:\>exiftool -P -overwrite_original -ModifyDate+="1:0:0 0:0:0" -if "$ModifyDate lt '2018:12:31' " y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -ModifyDate y:\!temp\Test4.jpg
Modify Date                     : 2019:03:31 12:23:04
Title: Re: Stymied by -IF condition
Post by: robertklink on December 26, 2019, 10:32:46 PM
Yea! That fixed it. That's the bad of taking a Linux example and blithely swapping double quotes for Windows.