ExifTool Forum

ExifTool => Newbies => Topic started by: dtw on August 14, 2017, 02:21:11 PM

Title: Copy tags to sidecar files with double extensions
Post by: dtw on August 14, 2017, 02:21:11 PM
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
Title: Re: Copy tags to sidecar files with double extensions
Post by: Phil Harvey on August 14, 2017, 03:30:44 PM
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
Title: Re: Copy tags to sidecar files with double extensions
Post by: dtw on August 14, 2017, 05:24:29 PM
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
Title: Re: Copy tags to sidecar files with double extensions
Post by: Phil Harvey on August 15, 2017, 07:29:59 AM
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
Title: Re: Copy tags to sidecar files with double extensions
Post by: dtw on November 02, 2017, 09:41:43 AM
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
Title: Re: Copy tags to sidecar files with double extensions
Post by: Phil Harvey on November 02, 2017, 10:00:00 AM
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
Title: Re: Copy tags to sidecar files with double extensions
Post by: dtw on November 05, 2017, 05:22:08 AM
Dear Phil,
over 700 files successfully (and correctly  :) ) updated.
Thanks so much!
Dirk