Skip to content

Instantly share code, notes, and snippets.

@katryo
Created December 27, 2015 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katryo/5a16e6ae6edc8c58bf40 to your computer and use it in GitHub Desktop.
Save katryo/5a16e6ae6edc8c58bf40 to your computer and use it in GitHub Desktop.
ファイル名を取得してyamlにするRubyスクリプト
require 'yaml'
names = []
Dir::glob('*.jpg').each do |filename|
names.push filename
end
names_hash = { 'names' => names }
names_yaml = names_hash.to_yaml
File.write('photo_names.yml', names_yaml.to_s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment