Skip to content

Instantly share code, notes, and snippets.

@EnsekiTT
Created February 24, 2016 15:07
Show Gist options
  • Save EnsekiTT/a62acf072e6220b6bd15 to your computer and use it in GitHub Desktop.
Save EnsekiTT/a62acf072e6220b6bd15 to your computer and use it in GitHub Desktop.
rename.rbを該当ディレクトリで実行すればなんとなく一斉に変更できる
dirlist = Dir::entries(".")
# ファイルをフィルタリングする
targets = dirlist.grep(/(.+)\.wav/)
# 変更ルールを決める
renametable = Array(targets.length)
targets.each_with_index do |name, i|
print i%19+1, ","
print i/19+1, "\n"
renametable[i] = [name, name.sub(/\.wav/, sprintf("_%05d.wav", i))]
end
# 確認する
renametable.each_with_index do |file, i|
print(file, "\n")
# この行を実行すれば一斉変更できる
# File.rename(file[0], file[1])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment