重命名图像以在名称中包含创建日期

Jac*_*ine 9 rename images

当我查看图像的属性时,我可以在“拍摄日期”中看到照片的拍摄日期。当我编辑图像(专有程序)时,这些数据会丢失。

如何在编辑之前重命名图像文件以包含此日期(最好以 ISO 格式按名称排序)。

Tim*_*imo 14

您可以使用exiftool执行此操作。从手册页:

   exiftool '-FileName<CreateDate' -d %Y%m%d_%H%M%S%%-c.%%e dir
        Rename all images in "dir" according to the "CreateDate" date and
        time, adding a copy number with leading '-' if the file already
        exists ("%-c"), and preserving the original file extension (%e).
        Note the extra '%' necessary to escape the filename codes (%c and
        %e) in the date format string.
Run Code Online (Sandbox Code Playgroud)

示例格式应该为您提供 ISO 格式的文件名。包括确保您每天可以处理多个图像的时间。

  • 另见`jhead` (3认同)

uml*_*ute 6

exiv2工具可以使用时间戳重命名文件:

来自man exiv2

mv | rename

根据 Exif 创建时间戳重命名文件和/或设置文件时间戳。使用标记 Exif.Photo.DateTimeOriginal 的值或(如果不存在)Exif.Image.DateTime 来确定时间戳。文件名格式可以用 -r fmt 设置,时间戳选项是 -t 和 -T。

所以以下可能会做你想要的:

exiv2 mv *.JPG
Run Code Online (Sandbox Code Playgroud)