ExifTool 完整使用指南
ExifTool 是由 Phil Harvey 开发的开源命令行工具,能读取和写入照片、视频几乎所有格式的元数据(EXIF、GPS、IPTC、XMP 等)。最新版本为 13.59(2026年5月)。
Windows
从 exiftool.org 下载 Windows 可执行文件 .zip,解压后将 exiftool(-k).exe 改名为 exiftool.exe,放到 C:\tools\ 或任意加入了 PATH 的目录即可。
也可以用 Scoop 安装:
scoop install exiftool验证安装
exiftool -ver一、查看元数据
Section titled “一、查看元数据”查看单张照片的全部信息
Section titled “查看单张照片的全部信息”exiftool photo.jpg输出会列出几十个字段,包括相机型号、拍摄时间、快门速度、光圈、ISO、GPS 等。
只查看指定字段
Section titled “只查看指定字段”exiftool -DateTimeOriginal photo.jpgexiftool -Make -Model -LensModel photo.jpgexiftool -GPSLatitude -GPSLongitude photo.jpg批量查看一个文件夹
Section titled “批量查看一个文件夹”exiftool D:\Photos\只显示文件名和拍摄时间(表格式输出)
Section titled “只显示文件名和拍摄时间(表格式输出)”exiftool -T -FileName -DateTimeOriginal D:\Photos\-T 参数让输出按制表符分隔,方便复制到表格。
导出为 CSV
Section titled “导出为 CSV”exiftool -csv -FileName -DateTimeOriginal -Make -Model D:\Photos\ > output.csv递归扫描子文件夹
Section titled “递归扫描子文件夹”exiftool -r D:\Photos\二、修改元数据
Section titled “二、修改元数据”修改拍摄时间
Section titled “修改拍摄时间”exiftool -DateTimeOriginal="2024:06:01 12:00:00" photo.jpg时间格式固定为 YYYY:MM:DD HH:MM:SS。
批量修改一个文件夹内所有照片的时间(偏移)
Section titled “批量修改一个文件夹内所有照片的时间(偏移)”比如照片时间全部偏差了 1 小时:
exiftool "-DateTimeOriginal+=0:0:0 1:0:0" D:\Photos\添加/修改 GPS 坐标
Section titled “添加/修改 GPS 坐标”exiftool -GPSLatitude=39.9042 -GPSLatitudeRef=N -GPSLongitude=116.4074 -GPSLongitudeRef=E photo.jpg修改版权和作者信息
Section titled “修改版权和作者信息”exiftool -Copyright="© 2024 Shai" -Artist="Shai" photo.jpg批量修改所有 JPG 的作者
Section titled “批量修改所有 JPG 的作者”exiftool -ext jpg -Artist="Shai" D:\Photos\三、清除元数据(去除隐私信息)
Section titled “三、清除元数据(去除隐私信息)”清除所有元数据
Section titled “清除所有元数据”exiftool -all= photo.jpg只清除 GPS 信息(保留其他数据)
Section titled “只清除 GPS 信息(保留其他数据)”exiftool -GPS:all= photo.jpg批量清除一个文件夹的 GPS
Section titled “批量清除一个文件夹的 GPS”exiftool -r -GPS:all= D:\Photos\四、批量重命名
Section titled “四、批量重命名”按拍摄时间重命名
Section titled “按拍摄时间重命名”将文件名改为 20240601_120000.jpg 格式:
exiftool "-FileName<DateTimeOriginal" -d "%Y%m%d_%H%M%S.%%e" D:\Photos\参数说明:
%Y年、%m月、%d日、%H时、%M分、%S秒%%e保留原始扩展名
加上相机型号前缀
Section titled “加上相机型号前缀”exiftool "-FileName<${Model}_${DateTimeOriginal}" -d "%Y%m%d_%H%M%S.%%e" D:\Photos\预览重命名结果(不实际执行)
Section titled “预览重命名结果(不实际执行)”exiftool "-FileName<DateTimeOriginal" -d "%Y%m%d_%H%M%S.%%e" -n D:\Photos\五、按时间自动归类到文件夹
Section titled “五、按时间自动归类到文件夹”这是整理散乱照片最实用的功能。
按年/月归类(推荐)
Section titled “按年/月归类(推荐)”将照片整理到 D:\Sorted\2024\06\ 这样的目录结构:
exiftool "-Directory<DateTimeOriginal" -d "D:/Sorted/%Y/%m" D:\Photos\按年归类(一级目录)
Section titled “按年归类(一级目录)”exiftool "-Directory<DateTimeOriginal" -d "D:/Sorted/%Y" D:\Photos\同时重命名 + 归类
Section titled “同时重命名 + 归类”exiftool "-FileName<DateTimeOriginal" -d "%Y%m%d_%H%M%S.%%e" "-Directory<DateTimeOriginal" -d "D:/Sorted/%Y/%m" -r D:\Photos\递归处理子文件夹
Section titled “递归处理子文件夹”加上 -r 参数:
exiftool -r "-Directory<DateTimeOriginal" -d "D:/Sorted/%Y/%m" D:\Photos\六、复制元数据
Section titled “六、复制元数据”从一张照片复制元数据到另一张
Section titled “从一张照片复制元数据到另一张”exiftool -TagsFromFile source.jpg target.jpg只复制时间信息
Section titled “只复制时间信息”exiftool -TagsFromFile source.jpg -DateTimeOriginal target.jpg七、常用参数速查
Section titled “七、常用参数速查”| 参数 | 说明 |
|---|---|
-r | 递归处理子文件夹 |
-ext jpg | 只处理指定扩展名 |
-n | 预览模式,不实际执行 |
-overwrite_original | 不保留备份文件 |
-q | 静默模式,减少输出 |
-csv | 输出为 CSV 格式 |
-T | 制表符分隔输出 |
-if "条件" | 条件过滤 |
-all= | 清除所有元数据 |
八、常见问题
Section titled “八、常见问题”Q:照片没有 EXIF,时间是错的怎么办?
先手动修正一张,确认格式正确,再批量偏移其他照片的时间。
Q:处理后文件变大了?
JPEG 写入元数据时 ExifTool 会重新整理文件结构,属于正常现象,图像质量不受影响。
Q:如何撤销操作?
ExifTool 默认保留 _original 备份文件。恢复方法:
exiftool -restore_original photo.jpg批量恢复:
exiftool -restore_original D:\Photos\- ExifTool 官网
- ExifTool 支持的文件格式列表
- ExifTool Tag Names 完整字段列表
- ExifToolGUI(图形界面版本,不想用命令行可以试试)