Renaming existing sidecar files from filename.xmp to filename.extension.xmp

Started by MMMM, December 18, 2024, 03:53:31 PM

Previous topic - Next topic

MMMM

Hi together,

I have a problem that until now I used the form filename.xmp for all my video files. However, now I need those sidecar files in the form filename.extension.xmp. Since the video files have different file formats I cannot just use any renaming tool an add e.g. mp4. I did a few trials in the form of

exiftool -ext xmp -tagsfromfile %d%f.EXT -r DIR
and

exiftool -ext EXT -tagsfromfile @ -srcfile %d%f.%e.xmp -r DIR
but did not have any luck. I would need something to search for all xmp files, check the file format of their respective video file and copy the content of the xmp file to a new xmp file with the desired name format "%d%f.%e.xmp". Could you please advice me on how to proceed?

Thank you very much

Phil Harvey

I think this may do it:

exiftool "-testname=%f.%e.xmp" --ext xmp -srcfile %d%f.xmp DIR

This runs through all files except XMP and renames the corresponding .xmp by adding the extension to the name.

Change "testname" to "filename" to actually rename the files if the output looks good.

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

MMMM

Thank you very much for the quick help, Phil.

I only had to change the < to an =, as was stated in an error message and now the code does exactly what I want. Thanks a lot!

I love your product and I'm impressed by what it can do. I use it a lot on a rather simple basis but also use many image tools that rely on exiftool in the background. Keep up the great work!

Phil Harvey

Great, thanks.  I've fixed my post to use = as you have corrected.

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