Skip to content

Instantly share code, notes, and snippets.

@jmark
Created January 24, 2015 21:21
Show Gist options
  • Save jmark/b8a3508d1b60a8e0d1d4 to your computer and use it in GitHub Desktop.
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
#!/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