Skip to content

Instantly share code, notes, and snippets.

@devm33
Created June 19, 2018 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devm33/a6d88ddeef210b48cef6bf197bef8781 to your computer and use it in GitHub Desktop.
Save devm33/a6d88ddeef210b48cef6bf197bef8781 to your computer and use it in GitHub Desktop.
Change the accessed / modified (and created on mac if older) of a bunch of photos to sort by date
#!/bin/bash
for f in *.jpg
do
num=${f//[^0-9]/}
secs=${num:0:4}
mmss=$(printf '%02d%02d\n' $((10#$secs/60)) $((10#$secs%60)))
touch -mt 20180528${mmss} $f
touch -t 20180528${mmss} $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment