前 | 2020年 7月 |
次 | ||||
日 | 月 | 火 | 水 | 木 | 金 | 土 |
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
たった20行。試しに写真約300枚分を処理。期待動作を確認して今日は終わり。ぼちぼち修正しよう。
#!/bin/bash JPGPATH="." century=19 IMGFILES_ORIG=(`find "$JPGPATH" -name "*.jpg" -exec ls {} \;`) if [ ${#IMGFILES_ORIG[*]} -eq 0 ]; then echo "Found" ${#IMGFILES_ORIG[*]} "files" echo "No file was found which has jpg extension in this directory. Something is wrong." exit 1 else for filename in ${IMGFILES_ORIG[@]} do basename=`basename ${filename}` year=${basename:0:2} month=${basename:2:2} date=${basename:4:2} hour=${basename:7:2} min=${basename:9:2} sec=${basename:11:2} ORIGINAL_DATE=${century}${year}":"${month}":"${date}" "${hour}":"${min}\":"${sec} #echo "${ORIGINAL_DATE}" exiftool -overwrite_original -AllDates="${ORIGINAL_DATE}" $filename done fi