Tag: photo

  • Organise photos by date

    I organise my photos by grouping them in a directory, where the directory takes on the name “created_date title” (e.g. 2016-05-16 Birthday Party). As it became tedious to create a directory and manually group photo sets, I wrote a Ruby script to assist with the heavy lifting. After that, it’s just a matter of providing a title to each created directory.

    require 'exifr'
    require 'fileutils'
    
    Dir['*.jpg'].each do |file|
    date = EXIFR::JPEG.new(file).date_time
    if date
    folder = date.strftime('%Y-%m-%d')
    FileUtils.mkdir_p(folder) unless File.directory?(folder)
    FileUtils.mv(file, folder)
    end
    end
    

    Note: you will first need to run gem install exifr to install dependencies.