2
\$\begingroup\$

I want to rename my files to include the camera model, but the full tag includes the make as well.

exiftool.exe -d %Y-%m-%d_%H%M%%-c.%%e  "-filename<${model;}_$CreateDate" -r DIRECTORY

Creates:

NIKON D750_2019-03-07_2156.nef
KODAK DC280 ZOOM DIGITAL CAMERA_1999-05-31_1200.jpg

Ideally, I would like only "D750" or "DC280" in the file name.

Is this something I can do in exiftool? Or would this be better done in some other 'renaming' program? Any recommendations?

There is no 'better' tag to use:

exiftool -s "KODAK DC280 ZOOM DIGITAL CAMERA_1999-05-31_1200.jpg"

ExifToolVersion                 : 11.38
FileName                        : KODAK DC280 ZOOM DIGITAL CAMERA_1999-05-31_1200.jpg
Make                            : EASTMAN KODAK COMPANY
Model                           : KODAK DC280 ZOOM DIGITAL CAMERA
Copyright                       : KODAK DC280 ZOOM DIGITAL CAMERA
CameraOwner                     : KODAK DC280 ZOOM DIGITAL CAMERA
\$\endgroup\$
2
  • 1
    \$\begingroup\$ I'm voting to close this question as off-topic because it is about manipulating data that is not related to the appearance of any photograph. \$\endgroup\$
    – Michael C
    Commented May 4, 2019 at 1:13
  • 1
    \$\begingroup\$ Most questions tagged metadata, file-management, and exiftool are about "about manipulating data that is not related to the appearance of any photograph". \$\endgroup\$
    – xiota
    Commented May 4, 2019 at 4:14

1 Answer 1

2
\$\begingroup\$

You can do this with ExifTool using a regular expression. I use this:

exiftool $TARGET '-filename<${createdate}_${model;s/-//g;s/ //g;tr/A-Z/a-z/}_${filename;tr/A-Z/a-z/}' -d %Y%m%d

which removes dashes and spaces and lower-cases the tag — it's the ${model;s/-//g;s/ //g;tr/A-Z/a-z/} part. You can use basically any perl-compatible regular expression there to do the transformation. If you're not familiar with this, you can read a bit more in the perl docs or on other tutorials online. The specifics of this scripting is out of scope for photography, I think, but this should get you started.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ For use in @RadOD specific case, they could use ${model;s/ZOOM DIGITAL CAMERA|KODAK|NIKON//;s/^\s+|\s+(?:$)//g} This will remove the offending words, then trim any leading/trailing white spaces. The reason there is a non-capture group around the $ is to avoid the $/ pattern, which exiftool treats as a new line in certain situations. \$\endgroup\$
    – StarGeek
    Commented May 5, 2019 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.