Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kampfgnu/793f2b25d3c412e27fd3c0a6c73b71f6 to your computer and use it in GitHub Desktop.
Save kampfgnu/793f2b25d3c412e27fd3c0a6c73b71f6 to your computer and use it in GitHub Desktop.
# cd $1
for file in *.{JPG,jpg,JPEG,jpeg}
do date=$(stat -f %B $file)
dateFormatted=$(date -r $date +%Y-%m-%d' '%H.%M.%S)
mv $file "$dateFormatted.jpg"
done
for file in *.{PNG,png}
do date=$(stat -f %B $file)
dateFormatted=$(date -r $date +%Y-%m-%d' '%H.%M.%S)
mv $file "$dateFormatted.png"
done
for file in *.{MOV,mov}
do date=$(stat -f %B $file)
dateFormatted=$(date -r $date +%Y-%m-%d' '%H.%M.%S)
mv $file "$dateFormatted.mov"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment