Little Help With XMP sidecar files and exiftool

Started by alexantao, February 04, 2023, 07:56:46 PM

Previous topic - Next topic

alexantao

Hi,

 I've worked with exiftool before, but just a little, and I think I have done something similar, but now I was looking for a specific way to do this and I'm strugling.

 This will be simple, but I need some help not to loose a lot of time and loose some information here.

  So...

   I have a huge photo library. It contains tons of photos taken from a variety of cameras, including iPhones (HEIC), Nikon (JPG and NEF) and also may contain PNG (not sure).

   I use digikam to organize them, and I put all of then on a strucre like:

      PHOTOS_ROOT_FOLDER/YEAR/MONTH_NUMBER - MONTH_NAME
 
    Inside this folder I can have lots of photos or subdirs with some specific event.

    My digikam is configured to store the metadata inside the files (EXIF), but since this structure was made from an export from another manager, most of the files has still XMP sidecar files with then.

     I need to take each XMP sidecar file and use exiftool to write all information it has INSIDE EXIF of the image file.

     Iwas thinking of making a bash script to recursively list all XMP files and use a EXIFTOOL command to write the information, but I think I found out that EXIFTOOL can already do the job with one command.

    I think I used the following command once in a script to do that, but I don'tknowifit will work for all file types:
exiftool -tagsfromfile SRC.xmp -xmp DST.jpg


     Could somebody point me how can I achieve this with exiftool ?

     If it's not possible with different file types (like RAW and JPG), I can do this twice, one for each file type...

  I apreciate any help on that...

   Best regards.

StarGeek

See Metadata Sidecar Files example #15.

The listed command uses the -ext (-extension) option to process only certain files.  To process everything, I would use --ext XMP (2 dashes) which will attempt to process all files except the XMP sidecars so you don't try to copy them back onto themselves.

There will be errors when there isn't a matching sidecar file, but you can ignore that.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

alexantao

Thanks ! I will try this.

 But, just a little correction, I found out that my sicecar files are names like IMAGE.JPG.xmp, not IMAGE.XMP

  The %d%f.xmp directive does not work because it will look for the IMAGE.xmp sidecar. Is there a variable to indicate the extension of the file, or the filename with extension ?

Phil Harvey

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

alexantao


StarGeek

Quote from: Phil Harvey on February 04, 2023, 09:50:59 PM%d%f.%e.xmp

Or %d%F.xmp, because I'm obsessed enough to want to use 3 fewer characters.

Side note of sillyness, as I was typing that, I paused over the word "fewer" and had to think about whether it was "less" or "fewer".  And just thinking that made me remember that Weird Al taught me the difference in his "Word Crimes" song


We now return you to your regular Exiftool forums, already in progress.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

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