Filename to EXIF Model

Started by dark_hawk, April 28, 2023, 12:55:20 PM

Previous topic - Next topic

dark_hawk

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.

StarGeek

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.
* 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).

dark_hawk

Thank you.

That works beautifully.