This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
exiftool [2022-05-26 18:29:39] mi created |
exiftool [2023-09-10 13:34:33] (current) mi |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| = Exiftool = | = Exiftool = | ||
| + | |||
| + | To see all available date/time fields in the file(s), use | ||
| + | |||
| + | exiftool -args -time:all *.jpg | ||
| == Exif rename by date | == Exif rename by date | ||
| - | Use original Exif date to add it to the file name, and also move the file to a folder by year-month: | + | Add the original Exif date to the beginning of the file name, and also move the file to a folder by year-month. |
| - | dest=/path/to/by_month # set destination to a different path | + | When using ''-testname'' instead of the real ''-filename'', it only prints what it would do. |
| - | exiftool -d '/path/to/bymonth/%Y-%m/%Y-%m-%d_%%f-v%%02.c.%%e' '-FileName<DateTimeOriginal' | + | |
| + | <code bash> | ||
| + | # set destination to a different path | ||
| + | dest=/path/to/by_month | ||
| - | * ''<nowiki>%%f</nowiki>'' : original filename (basename) without extension * | + | # test what it would do |
| - | * ''<nowiki>%%02.c</nowiki>'' : Numbering in case of duplicates: "00", "01", etc. * | + | exiftool -d "$dest/%Y-%m/%Y-%m-%d_%%f-v%%02.c.%%e" '-testname<DateTimeOriginal' /path/to/process |
| - | * ''<nowiki>%%e</nowiki>'' : extension | + | |
| - | See also: https://exiftool.org/filename.html | + | # do it |
| + | exiftool -d "$dest/%Y-%m/%Y-%m-%d_%%f-v%%02.c.%%e" '-filename<DateTimeOriginal' /path/to/process | ||
| + | </code> | ||
| + | |||
| + | To also process subdirectories, add the ''-r'' (or ''-recurse'') option | ||
| + | |||
| + | To only process files with a .jpg extension, use ''-ext jpg'' (case insensitive) | ||
| + | |||
| + | Example to rename all ".DNG" files in the current directory and it's subdirectories (without moving them): | ||
| + | |||
| + | <code bash> | ||
| + | exiftool -r -ext dng -d "%Y-%m-%d_%%f-v%%02.c.%%e" '-testname<DateTimeOriginal' . | ||
| + | </code> | ||
| + | |||
| + | Special variables in the ''-d'' specification: | ||
| + | |||
| + | * ''<nowiki>%%f</nowiki>'' : original filename (basename) without extension | ||
| + | * ''<nowiki>%%02.c</nowiki>'' : Numbering in case of duplicates: "00", "01", etc. | ||
| + | * ''<nowiki>%%e</nowiki>'' : extension | ||
| After the Exif rename, remove the unneeded "-v00" extension in the destination: | After the Exif rename, remove the unneeded "-v00" extension in the destination: | ||
| - | <code> | + | <code bash> |
| find "$dest" -iname "*-v00.jpg" -exec rename -v 's/-v00(\.jpg)/$1/i' {} + | find "$dest" -iname "*-v00.jpg" -exec rename -v 's/-v00(\.jpg)/$1/i' {} + | ||
| </code> | </code> | ||
| Line 25: | Line 48: | ||
| exiftool '-FileModifyDate<DateTimeOriginal' * | exiftool '-FileModifyDate<DateTimeOriginal' * | ||
| - | or | + | or |
| + | |||
| + | * ''-ext jpg'' : only .JPG files (case-insensitive) | ||
| + | * ''-r'' : Recursive (also process subfolders) | ||
| + | |||
| + | exiftool -r -ext jpg '-FileModifyDate<DateTimeOriginal' /path/to/process | ||
| + | |||
| + | == Copy JPEG Comment to Exif UserComment | ||
| + | |||
| + | For all .jpg files in current directory: | ||
| + | |||
| + | <code bash> | ||
| + | for f in *.jpg; do exiftool "-EXIF:UserComment<FILE:Comment" "$f"; done | ||
| + | </code> | ||
| + | |||
| + | == See also | ||
| + | |||
| + | * https://exiftool.org/filename.html and the [[https://exiftool.org/faq.html|ExifTool FAQ]] | ||
| + | * This guy's Exiftool Cheatsheet : https://gist.github.com/rjames86/33b9af12548adf091a26 | ||
| + | * And this even better one: [[https://ozzyczech.cz/bash/exiftool-tips-and-tricks/|Exiftool tips & tricks]] | ||
| - | find . -iname "*.jpg" -exec exiftool '-FileModifyDate<DateTimeOriginal' {} + | ||
| - | |||