Author Topic: xmp, darktable, loop  (Read 44 times)


  • Newbie
  • *
  • Posts: 8
xmp, darktable, loop
« on: February 13, 2019, 01:51:32 AM »
Dear all,
may I ask for your valuable advice again?
I am looking for a nice way to rename darktalbe-xmp with information necessarily coming from related nef/dng (and to improve my understanding for exiftool by the way)

The structure is as follows:
%d%f.%e              #nef or dng
%d%f.%e.xmp           # available for every image; darktable, first version
%d%f_01.%e.xmp    # sometimes, if another version is created, eg bw version,
%d%f_02.%e.xmp   # maybe more whatever versions in selected cases, eg 16:9 ratio etc.

I thought about a script with a loop:
Code: [Select]
#! /usr/bin/perl

while ($i != 0) {
$j +=1;
exiftool -ext nef -ext dng -tagsfromfile @ -d '%Y-%m-%d_%H%M%S' '-filename<${DateTimeOriginal}00_${model;s/\s//g}%+2c.%e.xmp'  '-filename<${DateTimeOriginal}${subsectimeoriginal}_${model;s/\s//g}%+2c.%e.xmp'  -srcfile %d%f_0$j.%e.xmp . ;

This loop is not working for other reasons, which I have not sorted out jet. The exiftool command alone works fine aslong as you do not use $j in -srcfile, but instead eg 1 and change that number for every run in my tests...
(so, I can solve my renaming problem by hand, but that is not that nice ...)

My major questions are therefore as follows:

Is it possible to retrieve $CountGoodWr?
Is it possible to use a variable within the filename-definition, like -srcfile %d%f_0$j.%e.xmp ?
Or, in general, is there a smarter way to solve that problem?

Thank you so much,

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 13989
    • ExifTool Home Page
Re: xmp, darktable, loop
« Reply #1 on: February 13, 2019, 07:36:59 AM »
Hi Dirk,

I would do it a bit differently, and avoid the looping.  I will present the command in argfile (-@) format since the argument list is fairly long:

Code: [Select]

- Phil

Edit:  Added a missing "%" character in the second -tagsFromFile argument
« Last Edit: February 14, 2019, 09:27:23 AM by Phil Harvey »
...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 ($).


  • Newbie
  • *
  • Posts: 8
Re: xmp, darktable, loop
« Reply #2 on: February 13, 2019, 05:26:26 PM »
OK, one more thing to study  :)
Thanks so much!