Assigning various date formats to different tags in single command line

Started by tommyzebman, February 21, 2019, 11:55:53 AM

Previous topic - Next topic

tommyzebman

When I try to do this, all date tags have the same format based on the last format read (I guess).

An example:

exiftool -progress -d %Y  "-copyright<Copyright $datetimeoriginal - Bill Jones.  All rights reserved." -d %Y%m%d  "-usercomment<datetimeoriginal" "D:\Temp\! Source"

Both date based tags use  %Y%m%d.

Is there a simple solution?

Thanks.

Phil Harvey

The -d option applies to all date/time tags.  Formatting different tags differently can be done with the advanced formatting feature.  For example:

exiftool -progress "-copyright<Copyright ${datetimeoriginal;DateFmt("%Y")} - Bill Jones.  All rights reserved." "-usercomment<${datetimeoriginal;DateFmt("%Y%m%d")}" "D:\Temp\! Source"

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

<deletes long detailed explanation because I'm too slow and Phil's too fast>

Also, if you have a lot of date tags you're working with, you can use the -d (dateFormat) option to format the majority of them, and then use the Advanced Formatting Helper function, DateFmt, on a per tag basis, though that would require the additional use of the -n (printConv) option hashtag option to negate the -d on a per tag basis.

exiftool -progress -d %Y "-copyright<Copyright $DateTimeOriginal - Bill Jones. All rights reserved." <insert more %Y Tag copy operations> "-usercomment<${datetimeoriginal#;DateFmt('%Y%m%d')}" "D:\Temp\! Source"
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

tommyzebman

Quote from: Phil Harvey on February 21, 2019, 12:03:12 PM
The -d option applies to all date/time tags.  Formatting different tags differently can be done with the advanced formatting feature.  For example:

exiftool -progress "-copyright<Copyright ${datetimeoriginal;DateFmt("%Y")} - Bill Jones.  All rights reserved." "-usercomment<${datetimeoriginal;DateFmt("%Y%m%d")}" "D:\Temp\! Source"

- Phil

This did not quite work.  It ran, but used default date format for both and spit out error message for each file.  Is there an additional command needed for Advanced Formatting feature?


OKAY:  This version worked.  Suggested by StarGeek   # after tag name and using single quotes around date format  '%Y'  ??

exiftool -progress "-copyright<Copyright ${datetimeoriginal#;DateFmt('%Y')} - Bill Jones. All rights reserved." "-usercomment<${datetimeoriginal#;DateFmt('%Y%m%d')}" "D:\Temp\! Source"

Never would have known that one.

StarGeek

Change the double quotes after DateFmt to single quotes.
${datetimeoriginal;DateFmt('%Y')}
${datetimeoriginal;DateFmt('%Y%m%d')}
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).