書捨てのプログラムを作成したので貼る。
require 'csv' require 'fileutils' require 'open-uri' csv_data = CSV.read('image_url.csv') puts "start..." csv_data.each do |data| id = data[0] url = data[1] sleep(2) #2秒待つ FileUtils.mkdir_p("./images/#{id}") begin open(url) do |file| open("./images/#{id}/0.jpg", "w+b") do |out| out.write(file.read) end end rescue OpenURI::HTTPError => e p e end p data end puts "complete!"