Having several digital cameras is fun: you can have different photography experiences.
However, organizing pictures is far less interesting, especially if you do not have a consistent process (like naming convention) for archiving. After several years, I end up with hundred thousand pictures sitting in messy huge folders:
The most tricky part, is that I have so many duplicate pictures everywhere due to inconsistent archiving during years. It is so messy that I never dare to manually clean them up.
Naturally, the knowledge of programming came to my rescue. This time, it is Python.
Long story short, I am using Python 3, and a lib exifread for extracting exif data from pictures.
You can install exifread by running below command
Then, here comes the ~100 line of code:
- sourceRootFolder and targetRootFolder specify the source and target folders (sorry, I am too lazy to parametric them)
- It extracts camera model and create a folder with same name, such as NIKON D40. It also works with smart phones, like Nokia 925.
- It extracts picture date, then create sub-folder with YYYY-MM format.
- Move the picture to that sub-folder. If there is already a file with same file name in the target folder, move this file to a backup folder. If the backup folder also have the same file, do nothing.
- It never delete any pictures.
After 20 min, everything is neat! Happy scripting!