Multiple commands in one?

Started by Lars, July 09, 2014, 02:26:45 PM

Previous topic - Next topic

Lars

Hi!

At the moment I execute both of this commands in each folder to rename jpg and mov files. Is there a way to work more efficient and combine the commands to one? (Mac osx)

exiftool -ext JPG '-FileName<CreateDate' -d "%a %d %b %Y %H.%M%%-c.%%le" .
exiftool -ext MOV '-FileName<FileModifyDate' -d "%a %d %b %Y %H.%M%%-c.%%le" .

Thanks!  :)

Phil Harvey

This is easier than people seem to think.  Here is the combined command:

exiftool -ext JPG -ext MOV '-FileName<FileModifyDate' '-FileName<CreateDate' -d "%a %d %b %Y %H.%M%%-c.%%le" .

The only trick is the order of the FileName arguments.  The last valid assignment takes precedence, so you want to copy CreateDate last since you want it to override FileModifyDate if available.

- 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 ($).

Lars

Thanks for the quick answer!

But.. ;) it doesn´t seem to solve my problem. The reason I use FileModifyDate on MOV files is that the existing exif data for CreateDate is wrong, so I need to use CreateDate for JPG and FileModifyDate for MOV, to get everything correct.

I tried your solution but it picks CreateDate for both JPG and MOV (as you explained "- The last valid assignment takes precedence"). I can live happily with executing exiftool twice per folder, but it would be cool if it's possible to combine them to one.

/ L

orax

Maybe :
exiftool  -ext JPG '-FileName<CreateDate' -execute  -ext MOV '-FileName<FileModifyDate' -common_args -d "%a %d %b %Y %H.%M%%-c.%%le" .

Phil Harvey

Thanks Orax.  That is exactly what I would have suggested.

- 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 ($).

Lars

Thanks orax,

That command works perfect!  :D

/ L