The original script, EXIFMover.py, can be found at github as a gist. It sorts the media files into folders named after the device that has created the image.
What I wanted was a more traditional scheme based on dates. I wanted the traditional /YEAR/month scheme.
So I forked EXIFMover.py and modified it. It can be found also as a gist in github (EXIFMover.py). What it finally does is:
- Checks all files on current folder (uncommenting and changing line 43, it can parse a specific folder)
- Checks if file has a valid extension (png, jpg, jpeg, mp4)
- Checks if it can extract date from file name (Search for "YYYY-mm-dd")
- If date can't be found on file name, it tries to extract date from exif data (if ExifRead is installed)
- If a date has been found it moves the file to folder/YEAR/month, creating the path if it doesn't exist
It is quite fast, as it has moved all my files in less than a second on Ubuntu. After that, Dropbox has to sync all the contents and it takes some time.
To use it on your folder full of images:
- Download the script from here into the folder where you have your images
- issue python EXIFMover.py on the command line
To use it, you need python installed. For more information check the comments on the script. An important one is this:
# This is experimental and one-way in a destructive sense, I take no responsibility
# if this absolutely destroys your directory structure for some reason