Hello :)
I'm not sure if it's a bug or intended but after a long testing process while doing some bash scripting, I found an odd behavior. Keep in mind I'm not that much versed with bash and exiftool in general.
System: Linux (EndeavourOS) and MacOS
Exiftool v.: 12.92
With the following image timestamps
======== /home/user/Pictures/IMG_5613.JPG_original_original_original
[System] FileModifyDate : 2018:05:01 23:24:46+02:00
[System] FileAccessDate : 2024:07:27 14:24:12+02:00
[System] FileInodeChangeDate : 2024:07:27 14:25:46+02:00
[IFD0] ModifyDate : 2011:10:10 08:15:16
And the following exiftool command:
exiftool -api QuickTimeUTC -d %Y/%B '-directory<$DateTimeOriginal/' '-directory<$CreateDate/' '-directory<$FileModifyDate/' '-directory<$ModifyDate/' '-directory<$DateAcquired/' '-FileName=%f%-c.%e' "$image_path"
ModifyDate takes precedent over FileModifyDate even if it's listed before ModifyDate and creates the following folder structure:
/home/user/2011/oktober/
Instead of :
/home/user/2018/mei/
Here's my final bash script in case it's important
#!/bin/bash
start_range=20160101
end_range=20221212
find /home/user/Media/ -type f -print0 | while IFS= read -r -d '' file_path; do
image_path=$file_path
FIRST_DATE=$(exiftool -m -d '%Y%m%d' -T -DateTimeOriginal -CreateDate -FileModifyDate -DateAcquired -ModifyDate "$image_path" | tr -d '-' | awk '{print $1}')
if [[ "$FIRST_DATE" != '' ]] && [[ "$FIRST_DATE" -gt $start_range ]] && [[ "$FIRST_DATE" -lt $end_range ]]; then
/usr/bin/vendor_perl/exiftool -api QuickTimeUTC -d %Y/%B '-directory<$DateTimeOriginal/' '-directory<$CreateDate/' '-directory<$FileModifyDate/' '-directory<$ModifyDate/' '-directory<$DateAcquired/' '-FileName=%f%-c.%e' "$image_path"
else
echo "Error"
fi
done
FileModifyDate isn't metadata found in the file. That's the timestamp on the file. Each time you alter the file, the FileModifyDate is updated by the operating system.
ModifyDate is metadata inside the file. Regardless of how many times you copy or touch the file, the internal ModifyDate doesn't change.
See FAQ 22 (https://exiftool.org/faq.html#Q22) for notes about order of operations for command-line arguments.
- Phil
Thanks Phill !
I'm really sorry for the unnecessary noise. At first I didn't understood what you meant but after re-reading your filename example 12 (https://exiftool.org/filename.html) it finally clicked... How stupid :/... I really thought it was the other way around... Matrixed !
Quote from: Neal Krawetz on July 27, 2024, 11:45:07 AMFileModifyDate isn't metadata found in the file. That's the timestamp on the file. Each time you alter the file, the FileModifyDate is updated by the operating system.
ModifyDate is metadata inside the file. Regardless of how many times you copy or touch the file, the internal ModifyDate doesn't change.
Thanks for the precision ! For my use case I specifically need the FileModifyDate timestamp being processed before ModifyDate tag :).
Will edit my post, can be closed, or moved.
Thanks again !!!
Quote from: KalyaSC on July 27, 2024, 04:59:21 PMFor my use case I specifically need the FileModifyDate timestamp being processed before ModifyDate tag :).
If you are copying from the
FileModifyDate, it should always be the first listed on the command line. That's because
FileModifyDate always exists, so exiftool will never fall back onto any tag copyies that appear before it.
From your example,
CreateDate will never be used, as using
FileModifyDate will always be successful
'-directory<$CreateDate' '-directory<$FileModifyDate'