Created
February 24, 2016 15:07
-
-
Save EnsekiTT/a62acf072e6220b6bd15 to your computer and use it in GitHub Desktop.
rename.rbを該当ディレクトリで実行すればなんとなく一斉に変更できる
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
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