Copy tags to sidecar files with double extensions

Started by dtw, August 14, 2017, 02:21:11 PM

Previous topic - Next topic

dtw

Dear All,
I failed to find an answer to the following (darktable-related) problem:

The Image and sidecar files are named as follows:

MyPicture_prev.jpg
MyPicture_prev.jpg.xmp
MyPicture.NEF
MyPicture.NEF.xmp


Relevant Metadata (Hierarchichal Tags) are coming in via MyPicture_prev.jpg.xmp (due to my personal workflow..)

It is easy to copy tags from  %f_prev.jpg.xmp to %f_prev.jpg or %f.NEF, just following the instructions on the homepage:
> exiftool -tagsfromfile %f_prev.jpg.xmp -HierarchicalSubject  -overwrite_original -ext NEF .

But I am unable to copy my tags to %f.NEF.xmp.

Thanks so much, Dirk

PS: A brief overview on unsuccessful attempts:

>exiftool -tagsfromfile %f.jpg.xmp -HierarchicalSubject  -overwrite_original -ext NEF.XMP .
or
> exiftool -tagsfromfile %f.jpg.xmp -HierarchicalSubject  -overwrite_original -ext ,,NEF.XMP" .
and of course
>exiftool -tagsfromfile %d%f.NEF -HierarchicalSubject  -overwrite_original -ext XMP .
Warning: Error opening file - ./2016-01-03_DSC_5286.NEF.NEF
Warning: Error opening file - ./2016-01-03_DSC_5286_prev.jpg.NEF
Warning: Error opening file - ./2016-01-17_DSC_5287.NEF.NEF
Warning: Error opening file - ./2016-01-17_DSC_5287_prev.jpg.NEF
    1 directories scanned
    0 image files updated
    4 image files unchanged

I also tried:
>exiftool -tagsfromfile %d%f.NEF -HierarchicalSubject  -overwrite_original -ext "*" --ext NEF --ext JPG .
Warning: Error opening file - ./.NEF
Warning: Error opening file - ./2016-01-03_DSC_5286.NEF.NEF
Warning: Error opening file - ./2016-01-03_DSC_5286_prev.jpg.NEF
Warning: Error opening file - ./2016-01-17_DSC_5287.NEF.NEF
Warning: Error opening file - ./2016-01-17_DSC_5287_prev.jpg.NEF


I furthermore fiddled around with
exiftool -tagsfromfile %f.%e -HierarchicalSubject  -overwrite_original -ext %e.XMP .
    1 directories scanned
    0 image files read

or
>exiftool -tagsfromfile %f_prev.jpg.xmp -HierarchicalSubject  %f.NEF.xmp .

... but I basically have not found a solution...

Best, Dirk

Phil Harvey

Hi Dirk,

Try this:

exiftool -tagsfromfile %d%f_prev.jpg.xmp -HierarchicalSubject -overwrite_original -ext NEF -srcfile %d%f.%e.xmp .

This command uses the tricky -srcfile option to change the file you are writing.

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

dtw

Hi Phil,
that's it!
Thanks so much!
-srcfile is tricky... I will try to understand, why I call -ext NEF to specify a xmp file ...
The %e in -srcfile  reflects the NEF specified in -ext NEF?
Best, Dirk

Phil Harvey

Hi Dirk,

Yes, %e always refers to the original file.  Otherwise the %e in the -srcfile option would have a different meaning (and this would be even more confusing!).

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

dtw

Hi Phil,
need your help again:

I am now failing with the opposite way:
copying -tagsfromfile from %f_prev.jpg to %f.jpg.xmp.

exiftool -tagsfromfile %f_prev.jpg -r -ext xmp DIR

does not work. This time, it is not -srcfile, I guess?

Thanks so much, Dirk

Phil Harvey

You have two problems in your command:

1. You need to remove the ".jpg" from the name of the .xmp file before adding "_prev" (ie. "%-.4f").

2. You need to include the directory (%d) for the -tagsFromFile file

So try this:

exiftool -tagsfromfile %d%-.4f_prev.jpg -r -ext xmp DIR

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

dtw

Dear Phil,
over 700 files successfully (and correctly  :) ) updated.
Thanks so much!
Dirk