Last active
October 21, 2022 03:18
-
-
Save liaocs2008/62332e334999264e985fea162c13ab31 to your computer and use it in GitHub Desktop.
sort images by names via modifying timestamp for google photos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# after running the script, use google photos their built-in timestamp based sorting function | |
i=0 | |
find ./ -name "*.jpg" | sort | while read filename; do | |
i=$((i+1)) | |
time=`date --date="-${i} seconds" '+%Y:%m:%d-%T'` | |
#echo $time | |
jhead -mkexif $filename | |
jhead -ts$time $filename | |
jhead -ta-128:00 $filename # add extra hour offset if necessary | |
# following won't work | |
#time=`echo "${time//:/}"` | |
#time=${time:0:12} | |
#touch -t $time "$filename" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment