theKindOfMe

May 15, 2010

A Ruby Script to Organize Digital Photos in to a Folder Hierarchy by Date/Time Taken

Filed under: Uncategorized — Tags: , — yasi8h @ 5:26 pm

So i was at home with nothing else to do. I had my new “NAT” with plenty of empty space and my collection of photos. Although when viewing with Picasa there photos were browse-able, when viewing it through a file explorer like nautilus, It was very hard browse them. So i wanted to organize them in to a folder structure that makes some sense. And this is what i came up with. Hope it will be of some use to someone.

Copies digital photos to a directory structure orgnazied by year/month/day/time.ext...etc

Folder Structure

Get it from github: http://github.com/thekindofme/Photo-Organizer

Photo Organiser

A Ruby script to copy and arrange your digital photos to a folder structure like /Root/Year/Month/Day/Time.jpg … It will use EXIF timestamp if its there or else take file creation timestamp.

Example

    bash> ruby photo_org.rb /path/to/source /path/to/destination dirs

Installation

  • Get the source.
  • Install exifr (gem install exifr) if you don’t have them already.

Notes

  • If there are two or more files with the same timestamp they will be copied as: file_name.jpg, file_name-1.jpg, file-name-2.jpg…etc
  • Duplicates will be copied to /path/to/dest/Duplicates
  • Non jpeg files will be copied to /path/to/dest/Other
  • The script creates a log file in the destination directory at the end of execution.
  • You can edit more settings like folder names, folder structure, file name…etc by editing the constants inside the script
  • Any feedback will be highly appreciated.



Advertisements

Blog at WordPress.com.