4 ## @brief Sets file mtime to the Exif.Image.DateTime of the file
6 ## $@ List of files to be processed
8 ## Requires exiv2 or exiftool
11 if [ -z "$(command -v exiv2)" ]
13 if [ -z "$(command -v exiftool)" ]
15 zenity --title="Geeqie exif datetime to file" --info --width=200 --text="Neither exiv2 nor exiftran is installed" --window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null
24 if ! zenity --title="Geeqie - exif datetime to file" --question --text "Set file datetime (mtime) to Exif.Image.DateTime\n\nContinue?" --width=300 --window-icon=/usr/local/share/pixmaps/geeqie.png
29 # exiv2 should be faster
30 if [ "$use_exiv2" = "true" ]
34 if date_time=$(exiv2 -g Exif.Image.DateTime -Pv "$1")
36 y_m_d_h_m_s=$(echo "$date_time" | tr ' ' ':')
37 y_m_d_h_m=$(echo "$y_m_d_h_m_s" | cut --delimiter ':' --fields '1 2 3 4 5' | tr --delete ':')
38 s=$(echo "$y_m_d_h_m_s" | cut --delimiter ':' --fields '6')
39 touch -m -t "$y_m_d_h_m.$s" "$1"
41 printf "Geeqie plugin exif-datetime-to-file -\nFile: %s does not have Exif.Image.DateTime\n" "$1"
48 if date_time=$(exiftool -t -createdate "$1")
50 y_m_d_h_m_s=$(echo "$date_time" | cut --characters '13-31' | tr ' ' ':')
51 y_m_d_h_m=$(echo "$y_m_d_h_m_s" | cut --delimiter ':' --fields '1 2 3 4 5' | tr --delete ':')
52 s=$(echo "$y_m_d_h_m_s" | cut --delimiter ':' --fields '6')
53 touch -m -t "$y_m_d_h_m.$s" "$1"
55 printf "Geeqie plugin exif-datetime-to-file -\nFile: %s does not have Exif.Image.DateTime\n" "$1"