Organising Photos on a Mac
Today I finally got around to doing something I have been putting off for a long time - I sorted out my inbox of photos! Yay \o/
For my own future reference, and just in case it is of use to anyone, I thought I would document the process.
I had an “inbox” of around 14,500 photos, videos, GIFs and PNGs going back around 18 months spread over about 15 directories on three different machines.
I organise my photos in to directories by time: by month and year, and I keep movies and GIFs, etc on directories of their own since I don’t have too many of these.
The aim of today’s operation was to sort the 14k files in to my usual structure.
Step 1 - Consolidate
First thing I had to do was sort out the various file formats and consolidate the images in one folder.
Using custom searches in Finder it is easy to find all the GIF, PNG and MOV/MP4 files and move them to the appropriate folders.
After that I wanted to get all of the JPG images it to a single directory. This is complicated by the fact that many of the files have the same name e.g. multiple IMG_0101.JPG’s So I turn to one of my favourite tools: Name Mangler
You can drag and drop the directories containing all the files that are required in to the tool and it will batch rename them in a variety of ways. I chose to name them incrementally ordered by date: IMG_00001.JPG, IMG_00002.JPG, etc. It renamed 14,500 files in about 20 seconds! Amazing.
With all of the files having a consistent naming convention I moved them all in to the one directory.
Step 2 - Remove Duplicates
I suspected I would have duplicate photos in this huge batch so I looked around and found this excellent tool on the Mac App Store, for free, Duplicate Photo Fixer.
I ran this over the photos directory and it found around 2,200 duplicates. Zero money well spent! :)
Step 3 - Using EXIF Data
A bit more tricky was the final step, I wanted to use the date the photos were taken to sort them in to directories. A bit of googling led me to a tool called ExifTool. This is a command line tool that has a good amount of documentation and help available online. After ten minutes of fiddling around I found that the following command did exactly what I needed when run in the directory of images:
$ exiftool -d %Y.%m "-directory<datetimeoriginal" .
This uses the datetimeoriginal property in the EXIF data to sort files and put them in a directory named for the year and month.
The command worked on about 12,000 files. The rest had no EXIF data so I put those in a directory of unknown time photos. Maybe I’ll get time to sort those out soon :)