A workflow to sort pictures and movies by date captured (EXIF data)

I have lots and lots of home made movies, mostly in the form of DV-tapes and SD-cards.

(This workflow also works for photos and other files, as long as they have EXIF-information embedded)

This is how I sort the pictures/clips by date

You need a proper OS  (Linux and OSX only! No toy-systems!)

You need exiftool (sudo apt-get install exiftool or brew install exiftool)

I assume the pictures/movies are already imported from the camera.

Flatten the directories

You can do this in many ways, but I usually create a separate directory IMG and MOV somewhere, let’s say the desktop.

Linux

Find and move all files

find . -type f -iname "*.mov" -o -iname "*.mp4" -exec mv --backup=t -t ../MOV/ {} +

Explanation

  • find all *.mov or *.mp4 files (-iname ignores case so *.MOV is also OK) in and under the current directory, recursively
  • EXEC the ‘mv’ command with special syntax -t . (target ../MOV directory). Also use the –backup=t so you won’t overwrite files in case there are more than one with the same name. It will use the suffix FILE.~1~, then FILE.~2~  and so on.
  • The ‘{}’ +  is just an optimization where mv will get as many arguments (files) as can be stuffed into the command line without breaking the maximum length.

perform this for every filetype you want to move. MOV,mov,JPG,jpg,PNG,png and so on.

OSX

sudo find . -mindepth 2 -type f -name "*.jpg" -exec mv '{}' ~/Desktop/IMG \;

Slightly slower since it will be executed once for each file

Move the files to subdirectory based on EXIF data

Here you might have to experiment a little

Next step

investigate the file(s) using

exiftool -s * | grep Date

Check the output, often you can use the field “CreateDate”, but also the “FileModifyDate” can be used. It depends!

Create directories based on EXIF data, and move the image there

exiftool -d %Y-%m-%d "-directory<CreateDate" *.JPG

Explanation:

  • exiftools checks the EXIF data on all JPG files
  • The “-directory<CreateDate” is a crazy syntax that means: “Create a directory using the value of field CreateDate, and move the file there!”
  • The -d %Y-%m-%d just specifies the syntax when creating the directory. YYYY-MM-DD will be the result.
  • repeat the process for each file type (JPG, jpg, MOV, mov etc)

Note: Some files don’t have the EXIF data, so there you are on your own!

Renaming files from date

exiftool '-filename<CreateDate' -d %Y%m%d_%H%M%S%%-c.%%le *.mov

sometimes CreateDate must be changed (ilke above) to CreationDate or something similar!

Counting Dates

exiftool -s * | grep Date | cut -f 1 -d " " | sort | uniq -c

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.