Advertisement
jhangyu

rename_date_stamp.sh

Jun 20th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.27 KB | None | 0 0
  1. for filename in $(ls | grep -P -o '[0-9]{13}(?=(\.jpg))')
  2. do
  3.     echo $filename
  4.     timevalue=$(echo $filename | grep -P -o '1[0-9]{9}(?=[0-9]{3})')
  5.     echo $timevalue
  6.     main_time=$(date -d @${timevalue} "+%Y-%m-%d-%H-%M-%S")
  7.     echo $main_time
  8.     mv $filename.jpg $main_time.jpg
  9. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement