ExifTool Forum

ExifTool => Newbies => Topic started by: dark_hawk on April 28, 2023, 12:55:20 PM

Title: Filename to EXIF Model
Post by: dark_hawk on April 28, 2023, 12:55:20 PM
Hi,

This may sound like a strange request.
I need to change the EXIF Camera model to part of the file name.
For example:
If I have some file names like this:
George Clooney 01.jpg
George Clooney 02.jpg
Brad Pitt 01.jpg
Brad Pitt 02.jpg

I want the camera model to read "George Clooney" and "Brad Pitt"
If that was unachievable with the ExifTool, I can manipulate the file names externally, but I want to change the Camera model in mass.

I'm using : "exiftool.exe -model="Model Name" file *.*" to change whole folders, but I need the Model Name to by dynamic, and taken from the file name.

Thanks in advance.
Title: Re: Filename to EXIF Model
Post by: StarGeek on April 28, 2023, 02:24:15 PM
It would take some tweaking depending upon the filename, but the basic command using your examples would be
exiftool "-Model<${Basename;s/\s+\d+$//}" /path/to/files/

This example strips off all the trailing numbers and all the spaces that are before the numbers.
C:\>exiftool -P -overwrite_original "-Model<${Basename;s/\s+\d+$//}" Y:\!temp\aaaa
    1 directories scanned
    4 image files updated

C:\>exiftool -G1 -a -s -model Y:\!temp\aaaa
======== Y:/!temp/aaaa/Brad Pitt 01.jpg
[IFD0]          Model                           : Brad Pitt
======== Y:/!temp/aaaa/Brad Pitt 02.jpg
[IFD0]          Model                           : Brad Pitt
======== Y:/!temp/aaaa/George Clooney 01.jpg
[IFD0]          Model                           : George Clooney
======== Y:/!temp/aaaa/George Clooney 02.jpg
[IFD0]          Model                           : George Clooney
    1 directories scanned
    4 image files read

The exact command would depend upon the actual format of your filenames.
Title: Re: Filename to EXIF Model
Post by: dark_hawk on April 28, 2023, 03:40:15 PM
Thank you.

That works beautifully.