Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

exiftool rename photos with camera model and date

I have been sorting my family photos, including some from a recovered backup drive my dad had. many of the photos were named file000268.jpg etc so I looked into renaming utilities, and ended up going with exiftool because I can use it in the shell and write scripts based around it (I use Mac and Ubuntu). I have a simple script working that renames photos to the date taken and it works great, but I am trying to add the camera make/model in front of the date, this will easily help me identify my dad's photos vs. photos from his graphic design clients(I know my parents had a kodak camera).

Here is the working script to rename photos with the date taken:

exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" /directory/ 

this results in photos named like this:

'2002-12-16 14.20.56.jpg'

I just want to add the camera make/model in front of the year ex:

'SONY CYBERSHOT 2002-12-16 14.20.56.jpg'

Thanks in advance for any help, I have been doing a ton of googling on this and have been pretty confused.

like image 270
glasses Avatar asked Mar 03 '15 15:03

glasses


1 Answers

From the exiftool v9.69 manpage:

exiftool '-filename<%f_${model;}.%e' dir

Rename all files in "dir" by adding the camera model name to the file name. The semicolon after the tag name inside the braces causes characters which are invalid in Windows file names to be deleted from the tag value (see the -p option documentation for an explanation).

In your case you can just run exiftool a second time after your initial rename:

exiftool '-filename<${model;} %f.%e' /directory/

Or all in one:

exiftool '-filename<${model;} ${datetimeoriginal}' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" /directory/
like image 113
speakr Avatar answered Nov 03 '22 23:11

speakr