ExifTool Forum

ExifTool => Newbies => Topic started by: BerndE on December 11, 2023, 12:42:02 PM

Title: renaming with %c and batch file
Post by: BerndE on December 11, 2023, 12:42:02 PM
Hi everybody,

this is exactly what I was looking for, unfortunately it doesn't work with my expression.
I tried diffferent things...

This works fine, but only  without %-c  and without -ext JPG :
exiftool -d  "%%y-%%m-%%d--%%H%%M%%S.%%%%e" "-filename<createdate" %* -k

adding %-c doesn't work:
exiftool -d  "%%y-%%m-%%d--%%H%%M%%S%-c.%%%%e" "-filename<createdate" %* -k

  CMD message:
C:\Users\BE\Desktop\test>exiftool -d  "%y-%m-%d--%H%M%S%* -k
  NAME
      exiftool - Read and write meta information in files
      ....

adding ext MOV -ext JPG also doesn't work:
exiftool -d  "%%y-%%m-%%d--%%H%%M%%S%.%%%%e" "-filename<createdate" -ext MOV -ext JPG -k

  CMD message:
C:\Users\BE\Desktop\test>exiftool -d  "%y-%m-%d--%H%M%S%e" "-filename<createdate" -ext MOV -ext JPG -k
  No file specified

Maybe anybody can help to get the correct expression with %-c and -ext MOV -ext JPG.
I thought it to be something like this (which doesn't work) ...
exiftool -d  "%%y-%%m-%%d--%%H%%M%%S%%-c.%%%%e" "-filename<createdate" -ext MOV -ext JPG -k

Many thanks,
Bernd
Title: Re: renaming with %c and batch file
Post by: StarGeek on December 11, 2023, 03:18:48 PM
Split from 11+ year old thread (https://exiftool.org/forum/index.php?topic=4178.0).

This is partly FAQ #27, My ExifTool command doesn't work from a Windows .BAT file (https://exiftool.org/faq.html#Q27).  But additionally, the %d/%f/%c/%e variables listed under the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut) must have the percent signs doubled when used in a -d (-dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat).  You have done this with %%%%e.  This must also be done as %%%%-c.

See the paragraph under Renaming Examples (https://exiftool.org/exiftool_pod.html#RENAMING-EXAMPLES) and the Writing "FileName" and "Directory" tags page (https://exiftool.org/filename.html).
Title: Re: renaming with %c and batch file
Post by: BerndE on December 12, 2023, 10:05:35 AM
Thank you very much for your help and I'm really sorry that I overlooked the board rules.

Now this one works fine using a Windows .BAT file:

exiftool -d "%%y-%%m-%%d--%%H%%M%%S%%%%-c.%%%%e" "-filename<createdate" -k %* -ext MOV -ext JPG
Thanks again,
Bernd