Author Topic: Multiple commands in one?  (Read 2249 times)

Lars

  • Newbie
  • *
  • Posts: 3
Multiple commands in one?
« on: July 09, 2014, 02:26:45 PM »
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!  :)
« Last Edit: July 09, 2014, 03:36:52 PM by Lars »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: Multiple commands in one?
« Reply #1 on: July 09, 2014, 05:21:21 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Lars

  • Newbie
  • *
  • Posts: 3
Re: Multiple commands in one?
« Reply #2 on: July 10, 2014, 07:12:18 AM »
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

  • Jr. Member
  • **
  • Posts: 19
Re: Multiple commands in one?
« Reply #3 on: July 10, 2014, 08:50:28 AM »
Maybe :
exiftool  -ext JPG '-FileName<CreateDate' -execute  -ext MOV '-FileName<FileModifyDate' -common_args -d "%a %d %b %Y %H.%M%%-c.%%le" .

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: Multiple commands in one?
« Reply #4 on: July 10, 2014, 09:28:41 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Lars

  • Newbie
  • *
  • Posts: 3
Re: Multiple commands in one?
« Reply #5 on: July 11, 2014, 12:14:49 PM »
Thanks orax,

That command works perfect!  :D

/ L