We have a pretty top-notch team here at Optify. Delivering great new features week after week is no small feat and everyone here pulls so much more than their weight that it’s really a pleasure when I get to show my appreciation with more than words. Recently I had such an opportunity when a teammate helped me get some crucial features into our latest release.
You see, Anthony is an avid photographer who has amassed quite the image collection over the years. He lamented that, as such, his file system was becoming rather cluttered. A wrongly-categorized photo here or a duplicate there is hard to find. Even with the solutions that are already out there some things slip through the cracks and there’s really nothing quite like a custom solution.
The requirements were rather simple: given a source directory, scan the directory and its subdirectories for all images with Exif headers and copy them into a destination directory with a directory structure based on the date the image was taken. For example, consider a source directory containing the following structure:
After running this program, the destination directory should have the following structure:
I’ll cut to the chase for those of you who want to try this for yourself with some download links:
- Windows: http://github.com/downloads/kjiwa/coprissi/coprissi-20121010-win32.zip
- Mac OS X (32-bit): https://github.com/downloads/kjiwa/coprissi/coprissi-20121010-macosx32.zip
- Mac OS X (64-bit): https://github.com/downloads/kjiwa/coprissi/coprissi-20121010-macosx64.zip
Running it is simple: open a command prompt or terminal, change to the directory containing the program, and execute the program with source and destination directories as arguments. Note that the Windows version requires Cygwin-style paths.
- Windows: coprissi /cygdrive/c/Users/kjiwa/SrcDir /cygdrive/c/Users/kjiwa/DstDir
- Mac OS X: ./coprissi /Users/kjiwa/SrcDir /Users/kjiwa/DstDir
For you hackers out there, the source code is free for you to use on GitHub: http://github.com/kjiwa/coprissi.
Some of you might be wondering why I chose to write this in C. You’re right if you think this could have been done with less code in a language like Python or Ruby or even Java. Well there are a few reasons, but it mostly boiled down to personal preference. I know there are a lot of you out there who don’t share this sentiment, but C is really my favourite language.
Give it a try and let me know what you think! I would love to know if this was useful for you, if you had problems, or if you have any suggestions for how it can be improved.