Skip to content

Instantly share code, notes, and snippets.

@elecnix
Created December 31, 2011 02:04
Show Gist options
  • Save elecnix/1542482 to your computer and use it in GitHub Desktop.
Save elecnix/1542482 to your computer and use it in GitHub Desktop.
Moves pictures to folders named by their date
#!/bin/bash
#
# Reads the EXIF date of all JPG files in the current folder,
# and moves the files to folders named by the date.
#
# On Ubuntu, the exif package is necessary:
# sudo apt-get install exif
for f in *.jpg *.JPG ; do
date=$(exif -t 0x9003 $f |grep Value|cut -d ' ' -f 4|tr ':' '-')
echo "$f: $date"
mkdir -p $date
mv $f $date/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment