Created
March 13, 2014 22:20
-
-
Save mmmaly/9538281 to your computer and use it in GitHub Desktop.
rename images and videos according to their creation time
This file contains hidden or 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
#!/bin/bash | |
#rename iPhone image/video files | |
#use only for tagged files | |
for i in *.mov | |
do | |
TIME=`exiftool "$i" | grep "Media Create Date" | sed -e 's/Media Create Date *: //'` | |
TOUCHTIME=`echo $TIME | sed -e 's/:/-/;s/:/-/;'` | |
FILENAME=`echo $TIME | sed -e 's/:/-/g;s/ /_/'` | |
touch -d "$TOUCHTIME" "$i" | |
EXT=${i##*.} | |
mv -i -v "$i" "$FILENAME"."$EXT" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment