Created
January 24, 2015 21:21
-
-
Save jmark/b8a3508d1b60a8e0d1d4 to your computer and use it in GitHub Desktop.
Rename image files to their creation date (unix timestamp) based on exif metadata
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
#!/bin/bash | |
# date: 2015-01-24 | |
# purpose: Rename image files to their creation dates | |
# (unix timestamp) based on exif metadata | |
for file in *; | |
do | |
tstmp=$(exiv2 "$file"\ | |
| grep -ia "image timestamp"\ | |
| perl -ne '@foo=split / /; print "$foo[-2]_$foo[-1]";'\ | |
| perl -ne 's/:/-/g; print;'); | |
# mv -v "$file" "$tstmp-$file"; | |
echo "$tstmp-$file"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment