Sorting images into folders based on exif year, month and date taken with bash

I need to sort about 18,000 home images taken over four years into a variety of folders on my home computer. We thought: hey, its on the server - mission complete. Three years later it’s an utter mess. Perhaps I can find the words to ask my computer to do this task for me.

First, you’ll need to install the exif tool:

sudo yum install perl-Image-ExifTool -y

Then, I ran the following command:

screen -S sort nice find ./Pictures -type d -exec exiftool '-Directory<DateTimeOriginal' -d Orginized/%Y/%m/%d {} \;

./Pictures being the location of the stuff I wanted to sort relative to my working directory, and Orginized/ being the dir I want to move them into.

The screen -S command starts up a screen session so you can press Control-A then d to background it and keep doing other work. The nice command makes my pathetic little Pentium 1.6 not explode into flames. Don’t you hate it when that happens???

This worked on Centos 5.4, i386.