Like anyone who has had a digital camera for any length of time organising your photographs can be a time consuming and frustrating matter. I recently decided to try and bring some order to the collection of numerous folders I had accumulated over the last number of year. Since it might be of assistance to someone here’s how I set about doing it.
My photo’s had at this stage been spread out across multiple drives and folders, some lumped together in logical groups based on the particular occasion (for example weddings, parties etc), while others simply where dumps of the SD cards as they where used.
To stamp order onto the collection I decided to break my collection down into folders divided up into year and month collections, where I wanted to view them in grouping by occasion I decided to leave that to the album software be it Google Photos, Shotwell or whatever. But on disc they would reside in a single directory sub-divided by year and month.
This would help minimise the collisions of names since it was unlikely that similar filenames would be used in the same year/month combinations.
Having settled on a tree structure, the next step required automating the process of extracting the image metadata and copying the image files into the appropriate location.
To that end I made use of the excellent ExifTool, which while a command-line tool is excellent at processing media files for the sort of information I needed to extract for these files.
Once I had installed the software I created a simple batch script to process the contents of a directory and copy the files to a staging area. In my case the staging directory was “d:/stagingImages” which can be changed to your own particular requirements.
The script file exifcopy.cmd is shown below:
@echo Processing [%1] @exiftool -o . "-Directory<filemodifydate" -d d:/stagingImages/%%Y-%%m -r %1 @pause
With both the above script and exiftool executable placed in the same folder, I can add that directory to the systems path to allow it to be be picked up by the command prompt.
Simply calling exifcopy with the source directory as a parameter will cause the directory in question to be queried and it’s contents copied to the staging directory in the structure detailed earlier.
To make the process even move straight forward I also added a new context menu for explorer to allow me to do this with a simple right click of the mouse. The script called CopyImagesToStaging.reg is shown below.
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\copyAndOrderImages] @="Copy and organise images" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\copyAndOrderImages\Command] @="CMD.exe /C exifcopy \"%1\""
Now by simply right-clicking a folder its contents would be queried and any images copied to the staging folder.
The updated staging directory contents can then be simply copyed to whereever your images are stored.