Skip to content

Instantly share code, notes, and snippets.

@arosh
Created October 22, 2011 11:59
Show Gist options
  • Save arosh/1305914 to your computer and use it in GitHub Desktop.
Save arosh/1305914 to your computer and use it in GitHub Desktop.
Renamer
#!/usr/bin/env ruby
files = Dir.glob("*.abc") # 拡張子で指定する
files.each do |f|
if f =~ /regex/ # 正規表現でガリガリ
puts "#{f} -> hogehoge - #{$1}.abc" # キャプチャーしたのも、てけとーに
#File.rename(f, "hogehoge - #{$1}.abc")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment