Created
September 23, 2013 17:14
-
-
Save campanalbero/6673860 to your computer and use it in GitHub Desktop.
カレントフォルダのJPGファイルのEXIFを読み取って、
yyyy-mm-dd 形式のフォルダを作って、
そこにJPGファイルを移動する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'exifr' | |
Dir.glob('*.JPG') do |f| | |
exif_time = EXIFR::JPEG::new(f).date_time_original | |
yyyymmdd = exif_time.strftime('%Y-%m-%d') | |
Dir::mkdir(yyyymmdd) unless FileTest.exist?(yyyymmdd) | |
File.rename(f, yyyymmdd + '/' + f) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment