Advertisement
xerpi

LINE pictures set date by filename

Dec 29th, 2022
1,324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.42 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. for f in *.jpg
  4. do
  5.     echo "Processing $f"
  6.     name=$(basename $f .jpg)
  7.     name_nomili=${name%???}
  8.     mili=${name: -3}
  9.     date_full="$name_nomili.$mili"
  10.     date_full_human="$(date -d @$name_nomili "+%Y-%m-%d %H:%M:%S").$mili"
  11.     echo "$date_full -> $date_full_human"
  12.     exiftool -overwrite_original_in_place -EXIF:CreateDate="$date_full_human" -EXIF:DateTimeOriginal="$date_full_human" $f
  13.     touch -d "$date_full_human" $f
  14. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement