Author Topic: Renaming CR2, XMP and PSD simultaneously.  (Read 406 times)

Andrei Korzhyts

  • Sr. Member
  • ****
  • Posts: 236
Renaming CR2, XMP and PSD simultaneously.
« on: July 11, 2019, 02:38:56 AM »
Is it possibly renaming
20191223.cr2
20191223.xmp
20191223.psd

to
20191223_bla-bla-bla.cr2
20191223_bla-bla-bla.xmp
20191223_bla-bla-bla.psd

?
I. e. I want to rename the RAW and automatically rename associated with it by name of XMP and PSD.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16885
    • ExifTool Home Page
Re: Renaming CR2, XMP and PSD simultaneously.
« Reply #1 on: July 11, 2019, 07:07:49 AM »
exiftool "-filename<%f_bla-bla-bla.%e" 20191223.*

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

Andrei Korzhyts

  • Sr. Member
  • ****
  • Posts: 236
Re: Renaming CR2, XMP and PSD simultaneously.
« Reply #2 on: July 11, 2019, 08:15:33 AM »
Спасибо, Фил.
But, looks like I asked the wrong question.

I have:
name_one.cr2
name_two.cr2
name_one.xmp
name_two.xmp
name_one.psd
name_two.psd


I need improve querry
exiftool -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S" "-FileName<D:\_\test\${DateTimeOriginal}_$FileNumber.%e" *.cr2
from https://exiftool.org/forum/index.php/topic,10277.0.html to include related XMP and PSD files:
20170626_124532_100-0004.cr2
20191223_032516_102-0412.cr2
20170626_124532_100-0004.xmp
20191223_032516_102-0412.xmp
20170626_124532_100-0004.psd
20191223_032516_102-0412.psd

Hayo Baan

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 1140
  • Professional Photographer & Software Developer
    • Hayo Baan – Photography
Re: Renaming CR2, XMP and PSD simultaneously.
« Reply #3 on: July 11, 2019, 08:34:16 AM »
You just need a -tagsfromfile:
Code: [Select]
exiftool -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S" -tagsfromfile "%f.cr2" "-FileName<D:\_\test\${DateTimeOriginal}_$FileNumber.%e"  -tagsfromfile "%f.cr2" .
Hayo Baan – Photography
Web: www.hayobaan.nl

Andrei Korzhyts

  • Sr. Member
  • ****
  • Posts: 236
Re: Renaming CR2, XMP and PSD simultaneously.
« Reply #4 on: July 11, 2019, 09:33:49 AM »
Спасибо.
It works, but:

1. The files have been copied, not moved. Need to move.
2. XMP-file has changed and the white balance is broken (screenshot attached).
3. <crs: RawFileName> is not updated in XMP (screenshot attached).

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16885
    • ExifTool Home Page
Re: Renaming CR2, XMP and PSD simultaneously.
« Reply #5 on: July 11, 2019, 09:37:10 AM »
I think there was a cut/paste error in the command that left an extra -tagsfromfile on the end.  Try this:

Code: [Select]
exiftool -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S" -tagsfromfile "%f.cr2" "-FileName<D:\_\test\${DateTimeOriginal}_$FileNumber.%e" .
- Phil

Edit:  Hmmm.  But this will fail if the CR2 is moved first.  So you really need to do this in two commands:

First this:

Code: [Select]
exiftool -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S" -tagsfromfile "%f.cr2" "-FileName<D:\_\test\${DateTimeOriginal}_$FileNumber.%e" --ext cr2 .
then

Code: [Select]
exiftool -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S" "-FileName<D:\_\test\${DateTimeOriginal}_$FileNumber.%e" -ext cr2 .
...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 ($).

Andrei Korzhyts

  • Sr. Member
  • ****
  • Posts: 236
Re: Renaming CR2, XMP and PSD simultaneously.
« Reply #6 on: July 11, 2019, 09:41:34 AM »
Спасибо.

I think there was a cut/paste error in the command that left an extra -tagsfromfile on the end.

That was my next question.  :)
I'll continue my research.