Menu

changing only year on date tags

6 days ago
6 days ago
  • Terrance Bennett

    I'm trying to change multiple date tag's year but am being receiving an error that i'm supplying invalid date/time.

    exiftool -s3 '-EXIF:ModifyDate' ./2009_080823-053923-00_OCF.jpg   
    
    2008:08:23 05:39:23
    

    shows what the current value is.

    exiftool -p '${EXIF:ModifyDate#; substr($_,0,4)="2009"}' ./2009_080823-053923-00_OCF.jpg   
    
    2009:08:23 05:39:23
    

    shows that it can be modified successfully with the Advanced formatting feature, whilst retaining the same formatting structure

    exiftool '-EXIF:ModifyDate=${EXIF:ModifyDate; substr($_,0,4)="2009"}' ./2009_080823-053923-00_OCF.jpg   
    
    Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in IFD0:ModifyDate (PrintConvInv)
    

    Is there anything that I'm doing wrong? I know there is an alternative date shift option however not all the files i'm looking to modify have the same current year.

     

    Last edit: Terrance Bennett 6 days ago
  • StarGeek

    StarGeek - 6 days ago

    This is Common Mistake #5c

    You use an equal sign when you want to set a tag to a static value, but you use a greater/less than sign when you want to copy one tag to another. In your command, you are trying to set ModifyDate to a value of
    ${EXIF:ModifyDate; substr($_,0,4)="2009"
    not trying to copy the changed ModifyDate back onto the original tag.

    Try:
    exiftool '-EXIF:ModifyDate<${EXIF:ModifyDate; substr($_,0,4)="2009"}' ./2009_080823-053923-00_OCF.jpg

     

Log in to post a comment.