exiftool 使用相机型号和日期重命名照片

exiftool rename photos with camera model and date

我一直在整理我的家庭照片,包括一些来自我父亲的恢复备份驱动器的照片。许多照片被命名为 file000268.jpg 等所以我研究了重命名实用程序,并最终使用了 exiftool 因为我可以在 shell 中使用它并编写基于它的脚本(我使用 Mac 和 Ubuntu)。 我有一个简单的脚本可以将照片重命名为拍摄日期并且效果很好,但我正在尝试在日期前添加相机 make/model,这将很容易帮助我识别我父亲的照片与来自他的平面设计客户(我知道我的 parents 有一台柯达相机)。

这是使用拍摄日期重命名照片的工作脚本:

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

这会产生这样命名的照片:

'2002-12-16 14.20.56.jpg'

我只想在年份前面加上相机make/model ex:

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

在此先感谢您的帮助,我一直在谷歌搜索这个问题,但一直很困惑。

来自 exiftool v9.69 联机帮助页:

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

在您的情况下,您可以在初始重命名后 运行 exiftool 第二次:

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

或合二为一:

exiftool '-filename<${model;} ${datetimeoriginal}' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" /directory/