Different date formats in a single exiftool command

Started by Athelstan, November 20, 2023, 11:12:17 AM

Previous topic - Next topic

Athelstan

In a folder I have JPG and MP4 files.

On my JPG files I want to set the -ReleaseDate tag to the value of the -CreateDate tag

On my MP4 files, I want to set the -ReleaseDate tag to the value of the -CreateDate tag maintaining the date format of the -CreateDate tag whilst also setting the -Year tag to the YEAR value of the -CreateDate tag.

I can do this with 2 commands

exiftool -r -ReleaseDate<CreateDate "C:\Pictures\sample photos"
exiftool -r -d %Y "-year<CreateDate" --ext jpg "C:\Pictures\sample photos"


Is it possible to merge these commands into a single command?

StarGeek

Not with the -ext (-extension) option.  That would have to be removed.

But it really isn't a problem because the Year tag cannot exist in a jpeg so that will be ignored.

To combine them, you would need to use the DateFmt helper function.

exiftool -r "-ReleaseDate<CreateDate" "-year<${CreateDate;DateFmt('%Y')}" "C:\Pictures\sample photos"

This would be the quoting for CMD.  The quoting on PowerShell will be different.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype